User Guide
Using operators to manipulate values in expressions 55
The strict equality (===) operator is similar to the equality operator, with one important
difference: The strict equality operator does not perform type conversion. If the two operands are
of different types, the strict equality operator returns
false. The strict inequality (!==) operator
returns the opposite of the strict equality operator.
The following table lists the ActionScript equality operators:
Assignment operators
You can use the assignment (
=) operator to assign a value to a variable, as shown in the
following example:
var password:String = "Sk8tEr";
You can also use the assignment operator to assign multiple variables in the same expression. In
the following statement, the value of
d is assigned to the variables a, b, and c:
a = b = c = d;
You can also use compound assignment operators to combine operations. Compound operators
perform on both operands and then assign the new value to the first operand. For example, the
following two statements are equivalent:
x += 15;
x = x + 15;
The assignment operator can also be used in the middle of an expression, as shown in the
following example:
// If the flavor is not vanilla, output a message.
if ((flavor = getIceCreamFlavor()) != "vanilla") {
trace ("Flavor was " + flavor + ", not vanilla.");
}
This code is equivalent to the following code, which is slightly easier to read:
flavor = getIceCreamFlavor();
if (flavor != "vanilla") {
trace ("Flavor was " + flavor + ", not vanilla.");
}
The following table lists the ActionScript assignment operators:
Operator Operation performed
==
Equality
===
Strict equality
!=
Inequality
!==
Strict inequality
Operator Operation performed
=
Assignment
+=
Addition and assignment