Priority of Operators
When evaluating an expression, the language processor usually works from left to right. But some operators are given a higher priority than others.
The complete order of precedence of the operators is (highest at
the top):
For any expression, you can discover the sequence that will
be used from the preceding list of priorities. For example:
| Operator | Description |
|---|---|
| \ ¬ – + | (prefix operators) |
| ** | (exponentiation) |
| * / % // | (multiply and divide) |
| + – | (add and subtract) |
| " " || abuttal | (concatenation, with/without blank) |
| == = \== ¬== /== \= ¬= /= > < >> << >< <> >= \< ¬< >>= \<< ¬<< <= \> ¬> <<= \>> ¬>> |
(comparison operators) |
| & | (and) |
| | && | (or, exclusive or) |
Say 3 + 2*5 /* says "13" */ Because
multiply (*) has a higher priority than add (+), the multiply operation
is done before the operation on its left.Similarly, because add (+) has a higher priority than concatenate
(blank),
Say 3 2+2 5 /* says "3 4 5" */For full details see z/VM: REXX/VM Reference.