-- (decrement)

Availability

Flash Lite 1.0.

Usage

--expression

expression--

Operands

None.

Description

Operator (arithmetic); a pre-decrement and post-decrement unary operator that subtracts 1 from expression. The pre-decrement form of the operator (--expression) subtracts 1 from expression and returns the result as a number. The post-decrement form of the operator (expression--) subtracts 1 from expression and returns the initial value of expression (the value before the subtraction).

Example

The following example shows the pre-decrement form of the operator, decrementing aWidth to 2 (aWidth - 1 = 2) and returning the result as bWidth:

aWidth = 3;
bWidth = --aWidth;
// The bWidth value is equal to 2.

The next example shows the post-decrement form of the operator decrementing aWidth to 2 (aWidth - 1 = 2) and returning the original value of aWidth as the result bWidth:

aWidth = 3; 
bWidth = aWidth--;
// The bWidth value is equal to 3.