Comparison operators compare the values of expressions and return a Boolean value (true
or false
). These operators are most commonly used in loops and in conditional statements. In the following example, if the variable score
is 100
, a certain movie loads; otherwise, a different movie loads:
if (score > 100){ loadMovieNum("winner.swf", 5); } else { loadMovieNum("loser.swf", 5); }
The following table lists the ActionScript comparison operators:
Operator | Operation performed |
< |
Less than |
> |
Greater than |
<= |
Less than or equal |
>= |
Greater than or equal |