Math Fundamentals18 sections · 814 units
Open in Course

Operator Precedence

Order matters

Boolean operators have precedence rules like arithmetic operators. NOT binds tightest, then AND, then OR. This means !a && b groups as (!a) && b, not !(a && b).

Similarly, a && b || c groups as (a && b) || c because AND has higher precedence than OR.

Precedence bugs cause subtle errors. If your condition behaves strangely, check the grouping. Parentheses override precedence and make intent clear to readers.