Operator Precedence
The following are the precedence levels and associativity of the operators in the Pyr language. The higher the precedence, the faster the operation will be performed.
| Operator | Description | Associativity | Precedence |
|---|---|---|---|
(), [] |
Function Call, Indexing | Left-to-right | 11 |
-, ! |
Negation | Right-to-left | 10 |
^ |
Exponent | 9 | |
*, /, % |
Multiply, Division, Modulo | Left-to-right | 8 |
+, - |
Addition, Subtraction | 7 | |
<<, >> |
Bitwise Shift Left, Bitwise Shift Right | 6 | |
<, <=, >, >= |
Less Than, Less Than or Equal, Greater Than, Greater Than or Equal | Not chainable | 5 |
==, != |
Equal, Not Equal | 4 | |
& |
Bitwise AND | Left-to-right | 3 |
| |
Bitwise OR | 2 | |
and, or |
Logical And, Logical Or | 1 | |
= |
Variable Assignment | Right-to-left | 0 |
For more information about each of the operators, see Arithmetic, Comparison and Bitwise.