24 / 2 - 8 ------ 12 - 8 --------- 4
When there are two (or more) operators of equal precedence, the expression is evaluated from left to right. Examples:
2 * 7 * 3 ----- 14 * 3 ------- 42 |
4 - 2 + 5 ----- 2 + 5 ------- 7 |
Usually it doesn't matter if evaluation is done left to right or in any other order. In algebra it makes no difference; But with floating point math it sometimes makes an important difference.
What is the value of the following expression?
2 + 4/2 + 1