2.2.3.2.19.1 Operator Behavior
The behavior of operators in an expression depends on the types of the operands. The following table lists the allowed operators and the results they produce with operands of various types.
Operator |
Operand1 |
Operand2 |
Result description |
---|---|---|---|
+ |
LONG |
|
Unary plus. |
+ |
LONG |
LONG |
Binary addition. |
+ |
STRING |
STRING |
Concatenation of strings. |
- |
LONG |
|
Unary minus. |
- |
LONG |
LONG |
Binary subtraction. |
* |
LONG |
LONG |
Binary multiplication. |
/ |
LONG |
LONG |
Integer division (for example, 7/3 = 2). |
% |
LONG |
LONG |
Modulo operator (for example, 7 % 3 = 1). |
++ |
LONG |
|
Unary post-increment or pre-increment operator. Variable supports set operations. |
-- |
LONG |
|
Unary post-decrement or pre-decrement operator. Variable supports set operations. |
= |
LONG |
LONG |
Simple assignment. |
= |
STRING |
STRING |
Simple assignment. |
= |
DATETIME |
DATETIME |
Simple assignment. |
< <= > >= == != |
LONG |
LONG |
Relational operator. Result is a LONG with a value of 0 or 1. |
< <= > >= == != |
STRING |
STRING |
Relational operator. Result is a LONG with a value of 0 or 1. |
< <= > >= == != |
DATETIME |
DATETIME |
Relational operator. Result is a LONG with a value of 0 or 1. |
! |
LONG |
|
Unary Not. Result is a LONG with a value of 0 or 1. |
&& |
LONG |
LONG |
Logical AND. Result is a LONG with a value of 0 or 1. Shortcut evaluation is supported. For example, in the expression "a && b", if "a" is false, "b" is not evaluated. |
|| |
LONG |
LONG |
Logical OR. Result is a LONG with a value of 0 or 1. Shortcut evaluation is supported. For example, in the expression "a || b", if "a" is true, "b" is not evaluated. |
() |
|
|
Allows precedence to be overridden. |
?: |
Any |
Any |
Conditional expression; for example, "(a < b)?c:d". If condition "a < b" is true, the value is "c", and "d" is not evaluated. If the condition "a < b" is false, the value is "d", and "c" is not evaluated. |
, |
Any |
Any |
Used to separate parameters in a function call or used in an expression to allow multiple statements to be evaluated. For example, "d = ( a = b, c = e )" will assign the value of "e" to "d". |