EasyManua.ls Logo

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE - Decrement Operator; Division Operator

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE
780 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
142 ActionScript language elements
-- decrement operator
--expression
expression--
A pre-decrement and post-decrement unary operator that subtracts 1 from the expression
. The expression can be a variable, element in an array, or property of an object. The pre-
decrement form of the operator (
--expression) subtracts 1 from expression and returns
the result. The post-decrement form of the operator (
expression--) subtracts 1 from the
expression
and returns the initial value of expression (the value prior to the
subtraction).
Availability: ActionScript 1.0; Flash Lite 1.0
Operands
expression : Number - A number or a variable that evaluates to a number.
Returns
Number - The result of the decremented value.
Example
The pre-decrement form of the operator decrements
x to 2 ( x - 1 = 2) and returns the result
as
y:
var x:Number = 3;
var y:Number = --x; //y is equal to 2
The post-decrement form of the operator decrements x to 2 (x - 1 = 2 ) and returns the
original value of
x as the result y:
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
i by 1.
for (var i = 10; i>0; i--) {
trace(i);
}
/ division operator
expression1 / expression2
Divides expression1 by expression2. The result of the division operation is a double-
precision floating-point number.
Availability: ActionScript 1.0; Flash Lite 1.0

Table of Contents

Related product manuals