Operators and Precedence¶
The Reflex language shares many of its operators with other C-like languages. The following table presents the different operators, and organizes them by precedence. Operators higher in the table take precedence over operators at lower rows in the table.
Level |
Operator |
Description |
Associativity |
---|---|---|---|
1 |
++ -- () [] . |
Pre Increment
Pre Decrement
Function call
Index Subscript
command selection
|
Left-to-right |
2 |
++ -- + - ! ~ ( T ) |
Post Increment
Post Decrement
Unary plus
Unary minus
Logical NOT
Bitwise NOT
Type cast
|
Right-to-left |
3 |
* / % |
Multiplication
Divide
Modulo
|
Left-to-right |
4 |
+ - |
Addition
Subtraction
|
Left-to-right |
5 |
<< >> |
Bitwise Left Shift
Bitwise Right Shift
|
Left-to-right |
6 |
< <= > >= |
Less than
Less than or equal
Greater than
Greater than or equal
|
Left-to-right |
7 |
== != |
Equal to
NOT Equal to
|
Left-to-right |
8 |
& |
Bitwise AND |
Left-to-right |
9 |
^ |
Bitwise XOR |
Left-to-right |
10 |
| |
Bitwise OR |
Left-to-right |
11 |
&& |
Logical AND |
Left-to-right |
12 |
|| |
Logical OR |
Left-to-right |
13 |
?: |
Ternary Operator |
Right-to-left |
14 |
= += -= *= /= %= <<= >>= |
Assignment
Assignment by sum
Assignment by difference
Assignment by product
Assignment by quotient
Assignment by modulo
Assignment by left shift
Assignment by right shift
|
Right-to-left |