On Tue, Jan 18, 2011 at 12:29 PM, Noury Bouraqadi <[email protected]> wrote: > 5 is the surprising answer of the expression: > 6 + 4 / 2 > > It should be 8 > But, I got 5 in both 1.1 and 1.2. > > Noury >
Hi, I'm just starting to learn smalltalk (thanks to PbE), but I'm pretty sure I know why this happens :-) Smalltalk has no knowledge of mathematics order, just operation order. In this case + and / are both binary operators so the operations are evaluated with the usual order, from left to right: (6 + 4) / 2 The answer 5 is correct. Regards Pietro
