Computer Science

Forgetting Boolean Operator Precedence

Students write mixed AND and OR conditions without parentheses and expect them to run left to right.

Quick check

Why students make it

They read the condition like an English sentence and group the words mentally. Since AND and OR are both logical connectors, they may assume they have the same priority.

The rule done right

Most languages evaluate NOT first, then AND, then OR. In Python this is not, and, or; in Java, JavaScript, and C-style languages this is !, &&, ||.