Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 81

Programming actionscript 3.0
Table of Contents

Advertisement

Postfix operators
The postfix operators take one operator and either increment or decrement the value.
Although these operators are unary operators, they are classified separately from the rest of the
unary operators because of their higher precedence and special behavior. When a postfix
operator is used as part of a larger expression, the expression's value is returned before the
postfix operator is processed. For example, the following code shows how the value of the
expression
is returned before the value is incremented:
xNum++
var xNum:Number = 0;
trace(xNum++); // 0
trace(xNum);
// 1
All the postfix operators, as listed in the following table, have equal precedence:
Operator
++
--
Unary operators
The unary operators take one operand. The increment (
this group are prefix operators, which means that they appear before the operand in an
expression. The prefix operators differ from their postfix counterparts in that the increment or
decrement operation is completed before the value of the overall expression is returned. For
example, the following code shows how the value of the expression
the value is incremented:
var xNum:Number = 0;
trace(++xNum); // 1
trace(xNum);
// 1
All the unary operators, as listed in the following table, have equal precedence:
Operator
++
--
+
-
!
~
Operation performed
Increments (postfix)
Decrements (postfix)
Operation performed
Increments (prefix)
Decrements (prefix)
Unary +
Unary - (negation)
Logical NOT
Bitwise NOT
) and decrement (
++
--
is returned after
++xNum
) operators in
Operators
81

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents