User Guide

Using operators to manipulate values in expressions 35
The following table lists the ActionScript comparison operators:
String operators
The addition (+) operator has a special effect when it operates on strings: It concatenates the two
string operands. For example, the following statement adds
"Congratulations," to "Donna!":
"Congratulations, " + "Donna!"
The result is "Congratulations, Donna!" If only one of the addition (+) operators operands is
a string, Flash converts the other operand to a string. ActionScript treats spaces at the beginning
or end of a string as a literal part of the string.
The comparison operators
>, >=, <, and <= also have a special effect when operating on strings.
These operators compare two strings to determine which is first in alphabetical order.
The comparison operators compare strings only if both operands are strings. If only one of
the operands is a string, ActionScript converts both operands to numbers and performs a
numeric comparison. Uppercase characters precede lowercase in alphabetic order, so “Eagle
comes before “dog.” If you want to compare two strings or characters regardless of case, you need
to convert both strings to upper- or lowercase before comparing them.
Operator Operation performed
<
Less than: Returns true if the left operand is mathematically smaller than the right
operand.
Returns
true if the left operand alphabetically precedes the right operand (for
example, a < b).
>
Greater than: Returns true if the left operand is mathematically larger than the right
operand.
Returns
true if the left operand alphabetically follows the right operand (for example,
b > a).
<=
Less than or equal to: Returns true if the left operand is mathematically smaller than
or the same as the right operand.
Returns
true if the left operand alphabetically precedes or is the same as the right
operand.
>=
Greater than or equal to: Returns true if the left operand is mathematically larger than
or the same as the right operand.
Returns
true if the left operand alphabetically follows or is the same as the right
operand.
<>
!=
Not equal: Returns
true if the operands are not mathematically equivalent.
Returns
true if the operands are not the same.
== Equality: Tests two expressions for equality. The result is
true if the expressions are
equal.
=== Strict equality: Tests two expressions for equality; the strict equality operator performs
the same as the equality operator except that data types are not converted. The result
is
true if both expressions, including their data types, are equal. Does not apply to
strings.