Search code examples
syntaxprogramming-languagescompilationoperatorsexpression-trees

Is there a language in which 2+3*5 isn't 17?


Well that's the question, is there any programming language in which 2+3*5 is not 17? I found this question into an old test of my faculty and caught my attention. Is no big deal, but I was in doubt. A plus would be why not??


Solution

  • According to this page, Smalltalk will produce a different result:

    in APL evaluation is strictly right to left, in Smalltalk it's strictly left to right

    APL will get the right result by coincidence - it will get an unexpected value on 3*5+2.