Error getting tags :
error 404Error getting tags :
error 404 - | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Version
-
Basics
Expander triangle
Type
Operator
Syntax

firstNumber - secondNumber

numberArray - {number | array}

-negativeNumber

Introduced
1.0
Changed
1.1
Environment
Desktop,Server,Web
Platform Support
MacOS,Mac OS X,Windows,Linux
Security
None required
Summary
Subtracts one number from another, or designates a number as negative.
Examples

put -24 into myContainer
put theRight - theLeft into theWidth
put myArray - 17 into adjustedValues

Additional Comments
Expander triangle

The - (minus) operator serves two purposes. When it has a single operand (unary minus), it negates that number. When it has two operands (binary minus), it subtracts the second number from the first number.

Parameters:

The operands firstNumber and secondNumber are numbers, or expressions that evaluate to numbers, or arrays containing numbers.

Comments:

To subtract a number from the contents of a container, use the subtract command.

You cannot use the unary minus twice in a row. The expression

- - someNumber

causes an error, and the expression

-- someNumber

is interpreted as a comment because it starts with the comment keyword --.

If firstNumber or secondNumber is an array, each of the array elements must be a number. If a number is subtracted from an array, the number is subtracted from each element. If an array is subtracted from an array, both arrays must have the same number of elements and the same dimension, and each element in one array is subtracted from the corresponding element of the other array.

If an element of an array is empty, the - operator treats its contents as zero.

The unary minus cannot be used with an array.

Changes to Revolution:

The option to subtract arrays was introduced in version 1.1. In previous versions, only single numbers could be used with the - operator.

User Comments
Expander triangle