-= (subtraction assignment)

Availability

Flash Lite 1.0.

Usage

expression1 -= expression2

Operands

expression1, expression2 Numbers or expressions that evaluate to numbers.

Description

Operator (arithmetic compound assignment); assigns expression1 the value of expression1 - expression2. No value is returned.

For example, the following two statements are the same:

x -= y;
x = x - y;

String expressions must be converted to numbers; otherwise, -1 is returned.

Example

Usage 1: The following example uses the -= operator to subtract 10 from 5 and assign the result to the variable x:

x = 2;
y = 3;
x -= y
trace(x);        // output: -1

Usage 2: The following example shows how strings are converted to numbers:

x = "2";
y = "5";
x -= y;
trace(x);        // output: -3