+= Operator

Adds a number to a variable, or causes concatenation with a string and a variable, then changes the variable to the result.

Syntax

variable += expression

Parts

variable
A numeric or string variable.
expression
An expression with a data type compatible with variable.

Instructions

The two statements that follow operate the same.

variable += expression
variable = variable + expression

Examples

Numeric

x = 30
x += 12
After execution
VariableValue
x42

String

x$ = "Hello"
x$ += " world"
After execution
VariableValue
x$"Hello world"

See also