Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 79

Programming actionscript 3.0
Table of Contents

Advertisement

For example, consider the less-than (
precedence. If both operators are used in the same expression, the operator on the left is
processed first because both operators are left-associative. This means that the following two
statements produce the same output:
trace(3 > 2 < 1);
trace((3 > 2) < 1); // false
The greater-than operator is processed first, which results in a value of
operand 3 is greater than the operand 2. The value
operator, along with the operand 1. The following code represents this intermediate state:
trace((true) < 1);
The less-than operator converts the value
numeric value to the second operand 1 to return the value
1).
trace(1 < 1); // false
You can alter the default left associativity with the parentheses (
the compiler to process the less-than operator first by enclosing that operator and its operands
in parentheses. The following example uses the parentheses operator to produce a different
output using the same numbers as the previous example:
trace(3 > (2 < 1)); // true
The less-than operator is processed first, which results in a value of
2 is not less than the operand 1. The value
along with the operand 3. The following code represents this intermediate state:
trace(3 > (false));
The greater-than operator converts the value
numeric value to the other operand 3 to return
trace(3 > 0); // true
The following table lists the operators for ActionScript 3.0 in order of decreasing precedence.
Each row of the table contains operators of the same precedence. Each row of operators has
higher precedence than the row appearing below it in the table.
Group
Primary
Postfix
Unary
Multiplicative
) and greater-than (
<
// false
true
false
false
Operators
[] {x:y} () f(x) new x.y x[y] <></> @ :: ..
x++ x--
++x --x + - ~ ! delete typeof void
* / %
) operators, which have the same
>
is then passed to the less-than
true
to the numeric value 1 and compares that
(the value 1 is not less than
false
) operator. You can instruct
()
false
is then passed to the greater-than operator,
to the numeric value 0 and compares that
(the value 3 is greater than 0).
true
because the
true
because the operand
Operators
79

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents