<<< Five arithmetic operators | Index | Integral Expressions >>> |
Operators can have
the same precedence
higher precedence
lower precedence
when used in combination. For example, an expression
2 + 3 * 4 // yields the value of 14
This is because multiplication operator has higher precedence than addition.
A programmer can override the built-in order of precedence by grouping subexpression with parenthesis:
( 2 + 3 ) * 4 // yields 20.
When operators have the same level of precedence, operations are performed from left to right
<<< Five arithmetic operators | Index | Integral Expressions >>> |