-= Operator

Subtracts the value of an expression from the value of a variable, then changes the variable to the result.

Syntax

variable -= expression

Parts

variable
A numeric variable or property.
expression
A numeric expression

Instructions

The two statements that follow operate the same.

variable -= expression
variable = variable - expression

The element on the left side of -= can be a scalar variable, a property, or an element of an array. If it is a property, it cannot have the modifier @ReadOnly.

The operator -= subtracts the value on its right side from the variable or property on its left side. Then it changes the variable or property on its left side to the result of that operation.

Examples

x = 50
x -= 8
After run
variablevalue
x42

See also