That's the same order I wrote....
Didn't you say that boolean expressions are evaluated from left to right and "and" and "or" have the same priority? Reply #3:
"Actually all Boolean operators have equal weight and evaluation in Pascal is left to right"I think rnfpc's code proves that this is not correct.
Look at the first expression:
t(0) and t(1) and t(2) or t(3) and t(4) or t(5).
Assuming left-to-right evaluation, and that AND and OR have the same "weight":
No disagreement that the left-most conditon, t(0), must be evaluated first. Its result is TRUE.
The next condition is an AND with t(1). Since the AND can turn a TRUE into a FALSE, t(1) must be evaluated.
The same with t(2) which is connected by an AND, too.
The next condition is an OR with t(3). Since the result of the expression is still TRUE and since the OR cannot change a TRUE any more, t(3) can be skipped.
Next, we have an AND with t(4) which must be evaluated for the same reason as before.
The final OR can be skipped again.
So, in total, the function t(0), t(1), t(2) and t(4) were called.
The program output tells, however, that t(4) was not called.
This can be understood if AND has a higher priority than OR. The expression can be rewritten like this
( t(0) and t(1) and t(2) ) or
( t(3) and t(4) ) or
t(5)
Since the first part of the OR expression, (t(0) and t(1) and t(2)), already yields TRUE which cannot be changed by the next OR expression only t(0), t(1) and t(2) need to be evaluated.