Expression evaluation is based on operators and operands. All binary operators take operands of the same type. The result type of arithmetic operations is the same as the operand type. The result type of comparison and logic operations is a Boolean value (True or False).
The binary + operator supports integer and string operands. For string operands the resulting string value is a concatenation of two operands.
The binary operators -, * and / support integer operands.
The unary operators + and - support integer operands. The + operand is complementary to the - operand and does nothing over its operand. The purpose of the unary + operand is in an expression like the following: (~CMP::rrt~ + 0). If a component replaces RRT ~CMP::rrt~ with a numeric value, the result of the expression will be the value. If a component replaces this RRT with an empty string, the expression will be still valid and the result is 0.
The result of an integer arithmetic operation must fit into a 32-bit signed integer, from -2147483648 to 2147483647.
Logic (Boolean) operations
The unary operator ! (NOT) supports a Boolean operand. The resulting Boolean value is the logical negation.
The binary operators & (AND) and | (OR) support Boolean operands only. The resulting Boolean value is a conjunction (disjunction) of the operands. The operands are evaluated from left to right. If the result of the first operand of an AND operation is False, then the second operand is not evaluated, and the result of the expression is False. If the result of the first operand of OR operation is true then the second operand is not evaluated, and the result of the expression is True.
This means that when an unevaluated operand contains semantic errors, such as a type mismatch or unknown identifiers, the expression will still be evaluated successfully.
The binary operators =, ==, and != (not equal) support string, integer and Boolean operands. The = operand is equivalent to == for integer and Boolean operands. For string operands, the = operator performs a case-insensitive comparison while the == operator performs a case-sensitive comparison.
The binary operators <=, >=, <, and > support string and integer operands only. These operators perform a case-sensitive comparison on strings.
Result type of all of these comparison operators is a Boolean value.
Conditional selection operation
The ternary operator ? takes three operators in the form exp_condition ? exp_result1 : exp_result2. The exp_condition must return a Boolean value. The two result operands exp_result1 and exp_result2 can be different types.
- If exp_condition evaluates to True, then the operation evaluates exp_result1.
- When exp_condition evaluates to False, then the operation returns exp_result2.
An integer constant must be decimal numeric value from 0 to 2147483647 (32-bit signed integer). The unary minus operator - should be used specify a negative integer value from a positive integer constant.
A string constant must begin and end with the double quotes character ". Special characters inside of string body must be "escaped" with the backslash \ character. The following escape sequences are valid within a string constant: \" (quote), \\ (backslash), \t (tab), \v (vertical tab), \r (carriage return), \n (new line).
Boolean constant must be one of the following: ON, YES, TRUE for True and OFF, NO, FALSE for False. These constants are case-insensitive.
"YES" — Is a string constant.
YES — Is a Boolean constant.
"10" — Is a string constant
10 — Is an integer constant.
Expression (10 > 9) — Is True.
Expression ("10" > "9") — Is False.
Expression ("YES"!= TRUE) — Is invalid, because it compares operands of different types (string against Boolean).
Expression (FALSE == OFF) — Is true, because both Boolean constants FALSE and OFF have same Boolean value False.
Expression (FALSE == 0) — Is invalid, because a Boolean is compared against an integer.
Expression (FALSE == ((3 + 4) != 0)) — Is False.
Only Boolean constants are supported. Other identifiers are undefined. For example, the expression ("ABCD" == ABCD) is invalid, since the ABCD identifier is undefined.