Operators are those characters, or keywords, that allow variables, constants and functions to be related to generate more or less complex expressions.
Operators can be divided into six groups:
•assignment operator (=)
•arithmetical operators (+ , - , * , /)
•logical operators(and, or, not, xor)
•numerical relational operators (> , < , = , <> , >= , <=)
•binary operators on integer variables(r_and, r_not , r_or , r_xor)
•string concatenation operator (#)
The natural precedences of operator execution are given in the table below. In general, the precedences are in the order:
•Unary
•Arithmetical
•Relationalal
•Binary on bits
•Binary logic
•Assignment
Brackets should be used to impose the desired order of execution. In general, it is advisable to add pairs of brackets whenever expressions may raise doubts about precedence.
Precedence is according to the order of writing. Groups identify the same level of precedence.
Minus unary |
- |
- var |
Plus unary |
+ |
+ var |
Not logical |
not |
not var |
Not binary |
r_not |
r_not (var) |
Multiplication |
* |
var * var |
Division |
/ |
var / var |
Addition |
+ |
var + var |
Subtraction |
- |
var - var |
Higher than |
> |
var > var |
Higher than or equal |
> = |
var > = var |
Less than |
< |
var < var |
Less than or equal |
< = |
var < = var |
Equal |
= |
var = var |
Different |
< > |
var < > var |
And binary |
r_and |
var r_and var |
Or binary |
r_or |
var r_or var |
Xor binary |
r_xor |
var r_xor var |
And logical |
and |
var and var |
Or logical |
or |
var or var |
Assignment |
= |
var = var |