The following table provides examples for using the SUB operator. The SUB operator subtracts operand2 from operand1.
Command |
Result |
set A = A SUB 1 A = 000123 |
123 - 1 = 122 This operation is valuable for count-down variables. If an operand has preceding zeros and is subtracted from or by another operand, the leading zeros are ignored. The resulting value does not retain the leading zeros. |
set A = A SUB 0456 A = 000123 |
123 - 456 = -333 = # The smallest result allowed is 0. Negative values are invalid (#). |
set A = A SUB 770 A = 777 |
777 - 770 = 7 The result is 7, not 007. |
set A = A SUB 10 A = 4294967296 |
# - 10 = # If an operand contains a value greater than 4294967295, the result is invalid (#). |
set A = A SUB # A = 000123 |
123 - # = # Special characters in a variable are invalid. |
set A = A SUB 100 Variable definitions:
|
123456 - 100 = 123356 = # This is an overflow condition because the result was greater than five digits. |