VARIABLES:
Variables are like buckets - they are containers where you can store information. You can call variables by any name you want but its good to follow certain conventions:
mySpecialVariable = "tomato";
Here we have created the variable called mySpecialVariable. We could also have named this variable x or vegetable.
+
Choose a name that is short and helps you to remember the purpose of the variable.
+ There should be no spaces in the name.
+ Typically the first word in your variable name is lower-case and subsequent words begin with the first character in upper-case: mySpecialVariable
+ The name of your variable cannot be any special words reserved by the Flash software.
Variables can store different types of information:
mySpecialVariable = "tomato123";
This variable is storing a String - a String is simply a group of characters. It can contain letters, numbers, punctuation. *Note - Strings are always contained in quotation marks.
mySpecialVariable = 23;
This variable is storing a Number
mySpecialVariable = true;
This variable is storing a Boolean - a Boolean is either set to true or false;
Consider:
george = 23;
john = "tomato";
george = john;
what does george = now?
george = "tomato";
|