-= Operator

Subtracts a number from a variable, then changes the variable to the result.

Syntax

variable -= expression

Parts

variable
Necessary numeric variable
expression
Necessary numeric expression

Instructions

The two statements that follow operate the same.

variable -= expression
variable = variable - expression

Examples

Example 1

x = 50
x -= 8
After execution
variablevalue
x42

See also