The operators below are listed in order of decreasing precedence.
The evaluation of an expression begins with the highest precedence operator and from left to right.
^ (or **)
|
Power of | precedence 2 |
*
|
Multiplication | precedence 3 |
/
|
Division | precedence 3 |
MOD (or %) |
Modulo (remainder of division) x MOD y = x – y * INT (x/y) |
precedence 3 |
+
|
Addition | precedence 4 |
-
|
Subtraction | precedence 4 |
Note
+ (addition) can also be applied to string expressions: the result is the concatenation of the strings.
The result of the ‘/’ (Division) is always a real number, while the result of the other operations depends on the type of the operands:
if all operands are integer, the result will be integer, otherwise real.
=
|
Equal | precedence 5 |
<
|
Less than | precedence 5 |
>
|
Greater than | precedence 5 |
<=
|
Less than or equal | precedence 5 |
>=
|
Greater than or equal | precedence 5 |
<> (or #)
|
Not equal | precedence 5 |
Note
These operators can be used between any two string expressions also (string comparison is case sensitive).
The result is an integer, 1 or 0.
There is not recommended to use the ‘=’ (Equal), ‘<=’ (Less than or equal), ‘>=’ (Greater than or equal),
‘<>’ (or #) (Not equal) operators with real operands, as these operations can result in precision problems.
AND (or &) |
Logical and | precedence 6 |
OR (or |) |
Logical inclusive or | precedence 7 |
EXOR (or @) |
Logical exclusive or | precedence 8 |
Note
Boolean operators work with integer numbers.
In consequence, 0 means false, while any other number means true.
The value of a logical expression is also integer, i.e., 1 for true and 0 for false.
It is not recommended to use boolean operators with real operands, as these operations can result in precision problems.