Order of operations in an if statement

In "if (tiltsensor == LOW && pushbutton1 == HIGH && doorswitch == HIGH)", that "tiltsensor == LOW && pushbutton1 == HIGH && doorswitch == HIGH" part is VERY MUCH a "mathematical expression", and obeys quite strict precedence and order-of-evaluation rules.
As a logical expression, it is permitted to stop evaluating the expression as soon as it knows the result, which can occasionally trick new users

1 Like

Required. Rely on it. Exploit it.

a7

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.