Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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??

like image 842
Tom Sarduy Avatar asked Dec 07 '25 13:12

Tom Sarduy


1 Answers

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.

like image 88
Sergey Kalinichenko Avatar answered Dec 10 '25 21:12

Sergey Kalinichenko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!