Increment Operator - MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

Returns
- The result of the comparison.
Boolean
See also
>= greater than or equal to operator

++ increment operator

++expression
expression++
A pre-increment and post-increment unary operator that adds 1 to
. The
expression
can be a variable, element in an array, or property of an object. The pre-
expression
increment form of the operator (
) adds 1 to
and returns the
++expression
expression
result. The post-increment form of the operator (
) adds 1 to
and
expression++
expression
returns the initial value of
(the value prior to the addition).
expression
The pre-increment form of the operator increments
to 2 (
) and returns the result
x
x + 1 = 2
as
:
y
var x:Number = 1;
var y:Number = ++x;
trace("x:"+x); //traces x:2
trace("y:"+y); //traces y:2
The post-increment form of the operator increments
to 2 (
) and returns the
x
x + 1 = 2
original value of
as the result
:
x
y
var x:Number = 1;
var y:Number = x++;
trace("x:"+x); //traces x:2
trace("y:"+y); //traces y:1
Availability: ActionScript 1.0; Flash Lite 1.0
Operands
- A number or a variable that evaluates to a number.
expression :
Number
Returns
- The result of the increment.
Number
150
ActionScript language elements

Advertisement

Table of Contents
loading

Table of Contents