–– (decrement)
Availability
Flash Player 4.
Usage
––expression
expression––
Parameters
A number or a variable that evaluates to a number.
expression
Returns
A number.
Description
Operator (arithmetic); a pre-decrement and post-decrement unary operator that subtracts 1 from
the
expression
The pre-decrement form of the operator (
returns the result. The post-decrement form of the operator (
and returns the initial value of
expression
more information, see
Example
The pre-decrement form of the operator decrements
var x:Number = 3;
var y:Number = --x;
//y is equal to 2
The post-decrement form of the operator decrements
value of
as the result
x
var x:Number = 3;
var y:Number = x--;
//y is equal to 3
The following example loops from 10 to 1, and each iteration of the loop decreases the counter
variable
by 1.
i
for (var i = 10; i>0; i--) {
trace(i);
}
. The
can be a variable, element in an array, or property of an object.
expression
"Operator precedence and associativity" on page
:
y
) subtracts 1 from
––expression
expression––
(the value prior to the subtraction). For
expression
to 2 (
-
x
x
to 2 (
x
x
CHAPTER 5
ActionScript Core Language Elements
expression
) subtracts 1 from the
32.
) and returns the result as
1 = 2
-
) and returns the original
1 = 2
–– (decrement)
and
:
y
81
Need help?
Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?