Decrement Operator; Division 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

-- decrement operator

--expression
expression--
A pre-decrement and post-decrement unary operator that subtracts 1 from the
. The
expression
decrement form of the operator (
the result. The post-decrement form of the operator (
and returns the initial value of
expression
subtraction).
Availability: ActionScript 1.0; Flash Lite 1.0
Operands
expression :
Number
Returns
- The result of the decremented value.
Number
Example
The pre-decrement form of the operator decrements
as
:
y
var x:Number = 3;
var y:Number = --x; //y is equal to 2
The post-decrement form of the operator decrements
original 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);
}

/ division operator

expression1 / expression2
Divides
expression1
precision floating-point number.
Availability: ActionScript 1.0; Flash Lite 1.0
142
ActionScript language elements
can be a variable, element in an array, or property of an object. The pre-
--expression
- A number or a variable that evaluates to a number.
:
y
by
. The result of the division operation is a double-
expression2
) subtracts 1 from
expression--
(the value prior to the
expression
to 2 (
-
x
x
1 = 2
to 2 (
-
x
x
1 = 2
expression
and returns
expression
) subtracts 1 from the
) and returns the result
) and returns the

Advertisement

Table of Contents
loading

Table of Contents