Just about anybody who have done any sort of programming would know what a variable is, but for the newcomers that are just starting out this one is for you
A variable is a simple means of keeping track of a value in your code. A variable can be defined to hold a constant value that never change, or it could be defined to change as often as necessary to suit your programming needs. The value of a variable can be set during author-time (while you are writing you code), or determined during run-time, like the score in a game.
The Basic syntax when defining a variable in actionscript is
var variableName : VariableType = newVariableValue ;
var is a keyword in the ActionScript language that tells flash that we are about to create a variable followed by the name that you would like to call the variable, then a colon, followed by the variable type; that I will explain in future posts and then there goes the equal sign that is known as the assignment operator that I will explain in details as we go along . The assignment operator is used to update the variable’s value to the value on the right side of the operator if that sound strange right now in a short while you will understand what this var war is all about.
The final bit in this line of code is a semicolon it is used to terminate code blocks or in this case complete statements, it also help to make you code more human readable.
If you are just starting to learn ActionScript or Object-C; pay close attention to your semicolon missing out one could cause you loads of debugging time, even though there are times when missing out a few will not stop you code from ruining .. it’s allways best to stay on the safe side where programing is concern
/*this is a comment with text that flash will not read I will explain "int" in future post */ var myVariable:int = 1234;
The Objective-C equivalent would look like this
/*this is a comment with text that the object-c compiler will not read I will explain what this mean in the next post */ int myVariable = 1234;
See you at the end of the next post.