Symbols > -= (subtraction assignment) |
![]() ![]() ![]() |
-= (subtraction assignment)
Availability
Flash Player 4.
Usage
expression1
-=
expression2
Parameters
expression1,expression2
A number or expression that evaluates to a number.
Returns
Nothing.
Description
Operator (arithmetic compound assignment); assigns expression1
the value of expression1
-
expression2
. For example, the following two statements are the same:
x -= y
;x = x - y;
String expressions must be converted to numbers or NaN
is returned.
Example
The following example uses the -=
operator to subtract 10 from 5 and assign the result to the variable x
.
x = 5;
y = 10;
x -= y
trace(x); //returns-5
Example
The following example shows how strings are converted to numbers.
x = "5"; y = "10"; x -= y; trace(x); // returns -5
![]() ![]() ![]() |