incorrect evaluation

Started by Thomas Bock, October 16, 2019, 09:45:34 AM

Previous topic - Next topic

Thomas Bock

In my opinion the following condition should print a star
if 1 or 0 and 0 then print "*"
It is the same as
if 1 or (0 and 0) then print "*"
or
1+0*0
For better understanding we will add the brackets.
PxPlus doesn't print a star. I'm curious, what am I missing?

James Zukowski

The 'AND' and 'OR' operators have the same precedence level, so they are evaluated left-to-right. In this case, it essentially works out to be:
if (1 or 0) and 0 then print "*"
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services