Operators
The set and localset commands not only set the value of variables, but also can set a variable to the result of an operation of two values. The following operators are allowed.
Given two values of value1 and value2:
- String:
- VARIABLE_NAME= value1 PLUS value2 - VARIABLE_NAME is set to the the string concatenation of value1 and value2
- Floating Point:
- VARIABLE_NAME= value1 + value2 - VARIABLE_NAME is set to value1+value2 (floating point)
- VARIABLE_NAME= value1 - value2 - VARIABLE_NAME is set to value1-value2 (floating point)
- VARIABLE_NAME= value1 * value2 - VARIABLE_NAME is set to value1*value2 (floating point)
- VARIABLE_NAME= value1 / value2 - VARIABLE_NAME is set to value1/value2 (floating point)
- Integer:
- VARIABLE_NAME= value1 DIV value2 - VARIABLE_NAME is set to value1/value2 (integer divide - value1 and value2 are rounded to integers first)
- VARIABLE_NAME= value1 MOD value2 - VARIABLE_NAME is set to value1 modulus value2 (integer modulus (remainder) - value1 and value2 are rounded to integers first)
- Binary:
- VARIABLE_NAME= value1 & value2 - VARIABLE_NAME is set to value1 BITWISE-AND value2 (binary and - value1 and value2 are rounded to integers first)
- VARIABLE_NAME= value1 | value2 - VARIABLE_NAME is set to value1 BITWISE-OR value2 (binary or - value1 and value2 are rounded to integers first)
- VARIABLE_NAME= value1 ^ value2 - VARIABLE_NAME is set to value1 BITWISE-XOR value2 (binary exclusive or - value1 and value2 are rounded to integers first)
- Logical:
- VARIABLE_NAME= value1 AND value2 - VARIABLE_NAME is set to value1 AND value2 (logical - values are interpreted as boolean values)
- VARIABLE_NAME= value1 OR value2 - VARIABLE_NAME is set to value1 OR value2 (logical - values are interpreted as boolean values)
- VARIABLE_NAME= value1 XOR value2 - VARIABLE_NAME is set to value1 XOR value2 (logical - values are interpreted as boolean values)
- Numerical Comparison:
- VARIABLE_NAME= value1 = value2 - VARIABLE_NAME is set to "TRUE" if value1=value2
- VARIABLE_NAME= value1 < value2 - VARIABLE_NAME is set to "TRUE" if value1<value2
- VARIABLE_NAME= value1 > value2 - VARIABLE_NAME is set to "TRUE" if value1>value2
- VARIABLE_NAME= value1 <> value2 - VARIABLE_NAME is set to "TRUE" if value1<>value2
- VARIABLE_NAME= value1 <= value2 - VARIABLE_NAME is set to "TRUE" if value1<=value2
- VARIABLE_NAME= value1 =< value2 - VARIABLE_NAME is set to "TRUE" if value1<=value2
- VARIABLE_NAME= value1 >= value2 - VARIABLE_NAME is set to "TRUE" if value1=>value2
- VARIABLE_NAME= value1 => value2 - VARIABLE_NAME is set to "TRUE" if value1=>value2
- String Comparison:
- VARIABLE_NAME= value1 EQ value2 - VARIABLE_NAME is set to "TRUE" if value1 is the same as value2
- VARIABLE_NAME= value1 NOTEQ value2 - VARIABLE_NAME is set to "TRUE" if value1 not the same as value2