3 ms·
What bad things happen if you just evaluate everything left to right and use parentheses to force evaluation? I.e., with no parenthesis it works exactly as a l
by jancsika 5y ago
What bad things happen if you just evaluate everything left to right and use parentheses to force evaluation?
I.e., with no parenthesis it works exactly as a layperson typing numbers into a calculator and feeding the answer into the next calculation. And with parentheses, the layperson can specify some calcs to happen out of order.
- colejohnson66 5y agoIt breaks the expectation of programmers that operators in PEMDAS (or whatever you call it) are evaluated how you expect. If I type: d = a + b * c I expect it to be evaluated as: d = a + (b * c) Maybe that’s just me, but I bet I’m not the only one that thinks that way. For non math operators, you may have a point…