Now **variables** are interesting objects. Its pretty similar to algebra, the way you solve for the unknown *x*, but in this case you decide what *x* is!

Take hits for example:

You are trying to find out the number of seconds in a year. So you would take 365 days multiplied by 24 hours multiplied by 60 minutes multiplied by 60 seconds. 31536000 seconds is the answer. Now imagine you have to refer to this multiple times in your calculation, without variables, you would have to constantly refer to 31536000, you might not even get the number correct, and if you are writing a program that involves a lot of numbers, you might end up not remembering what this number stands for! And numbers are really difficult to type quickly on the keyboard.

With variables, what you can do is you give a name to 31536000, lets say you call it seconds-in-a-year. Now it is much easier to remember, since it is literal, easier to type and harder to misspell. So at this point you might be even more interested and want to find out how to give a name to these expressions:

Name = Expression

seconds-in-a-year = 31536000

Or you if you remember the concept on Backus Naur form, expressions can be made up of even more expression you can have this:

seconds-in-ten-years = seconds-in-a-year * 10

That is the magic of variables.

Continue to try the Variables Quiz and if you have any questions just ask away below!

### Like this:

Like Loading...

*Related*