Operation
Subtracts the value of one expression from the value of another, with only one expression taking the opposite number.
Syntax 1
result = number1 - number2
Syntax 2
-number
Parameters
Result
Any numeric variable .
Number
Any numeric expression .
Number1
Any numeric expression.
Number2
Any numeric expression.
Description
In Syntax 1, the- operator is the arithmetic subtraction operator, which is used to get the difference between two values. In Syntax 2, the- operator is used as a unary negative operator to indicate the negative value of an expression.
For Syntax 2, as with all unary operators, an expression is evaluated according to the following rules:
- If applied to an undefined or null expression, a run-time error is generated.
- object is converted to a string.
- If possible, the string is converted to a numeric value. If not, a run-time error is generated.
- The Boolean value is treated as a numeric value (0 if False, or 1 if true).
The operator is used to produce a numeric value. In Syntax 2, if the generated value is not 0, then result is equal to the value that is generated by reversing the symbol. If the generated value is zero, then result is zero.
Requirements
Version 1
Please see
- = operator | Operator Precedence | Operator Summary