Learning ActionScript 2.0 in Adobe Flash |
|
|
|
| Syntax and Language Fundamentals > About operators > Using assignment operators | |||
You can use the assignment operator (=) to assign a given value to a variable. You might assign a string to a variable, as follows:
var myText:String = "ScratchyCat";
You can also use the assignment operator to assign several variables in the same expression. In the following statement, the value of 10 is assigned the variables numOne, numTwo, and numThree.
var numOne:Number; var numTwo:Number; var numThree:Number; numOne = numTwo = numThree = 10;
You can also use compound assignment operators to combine operations. These operators perform the operation on both operands, and then they assign the new value to the first operand. For example, both of these statements do the same thing:
var myNum:Number = 0; myNum += 15; myNum = myNum + 15;
|
|
|
|