You may have heard this word a lot and will continue to do so as you learn more about programming.
To figure out what it means let’s look at the word itself: variable.
If something is variable it changes, or can be changed.
Variables are used in programming to hold numbers, these numbers can then be used later on in the program and can also be changed, increased, decreased, mulitplied etc.
Variables will be a crucial part of your programs.
In the flashing LED program on page 3, you may have noticed that at the very top there is a line that says int led = 2; - this is called declaring a variable.
Firstly, you can have different types of variables: they can be different types of numbers – e.g. whole numbers or decimals and can also be words or letters. Have a look at page 4 in your arduino guide for more info.
In this case the type of variable you are using is int, this means integer, as in whole number. The name of the variable is led and the value of the variable is 2.
In this case, this has been done, because the led is connected to pin 2 and throughout the program you can use the word led, instead of the number 2, because this makes it easy to understand that you are using an LED. Go back through the program and replace led with 2 and you will find that it does exactly the same thing.
Think of variables as boxes, if you have a box that is labelled int on the outside, it means that you can put objects in the box, such as led, button, signal, motor etc. as long as the value of each item is a whole number.
Int (this variable is a whole number) led (this variable is called led) = 2 (the value of led is 2)