+= (addition assignment)

Availability

Flash Lite 1.0.

Usage

expression1 += expression2

Operands

expression1, expression2 Numbers or strings.

Description

Operator (arithmetic compound assignment); assigns expression1 the value of expression1 + expression2. For example, the following two statements have the same result:

x += y;
x = x + y;

All the rules of the addition (+) operator apply to the addition assignment (+=) operator.

Example

The following example uses the addition assignment (+=) operator to increase the value of x by the value of y:

x = 5;
y = 10;
x += y;
trace(x);        // output: 15 

See also

+ (numeric add)