Report an Error

Reported page · Common Mistake

Forgetting Boolean Operator Precedence

/mistakes/computer-science-forgetting-boolean-operator-precedence/

or drop them here

Up to 3 images or PDFs, 5 MB per file. 0 of 3 attached.

Save resource to class

Loading your classrooms…

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 !, &&, ||.