8.8.4 -= operator (subtraction) (assign to a variable the difference between a variable and an expression)
- Purpose
-
Subtracts an expression from a variable, and assigns the result to the variable.
- Syntax
Result -= Number
- Arguments
-
- Result
-
Specify a variable for storing the subtraction result.
- Number
-
Write any numerical expression.
- Description
-
The -= operator subtracts the value of the expression Number from the value of the variable Result, and assigns the difference to the variable Result.
If both values are Empty, the number 0 is set in Result. If Result is an Empty value or undefined, -Number (the numerical expression with its sign reversed) is assigned to Result. If Number is an Empty value, the value of Result is unchanged.
- Examples
' This code stores -1 in variable result1. Dim result1 result1 -= 1 ' This code stores 9 in variable result2. result2 = 10 result2 -= 1
- JP1/Script version
-
Supported from JP1/Script 06-51.