The table below summarizes the rules for precedence and associativity
of all operators. Operators on the same line have the same precedence;
rows are in order of decreasing precedence, so, for example,
*
, /
, and %
all have the same
precedence which is higher than that of +
and -
.
Operator | Precedence |
() [] `` | left to right |
! not ++ -- - * & # | right to left |
* / % | left to right |
+ - // | left to right |
< <= > >= | left to right |
== != | left to right |
&& and | left to right |
|| or | left to right |
?: | right to left |
= += -= | right to left |