The specification requires combinations of these operators within conditions.
Precedence order
| Priority | Operator |
|---|
| 1 (highest) | NOT |
| 2 | AND |
| 3 (lowest) | OR |
So A OR B AND C means A OR (B AND C) — the AND binds tighter.
Why this matters
IF isAdmin OR isMember AND hasPaid THEN
Because AND binds first, this is isAdmin OR (isMember AND hasPaid) — an admin gets in regardless of payment. If you intended "(admin or member) and has paid", you must bracket it:
IF (isAdmin OR isMember) AND hasPaid THEN
These two conditions behave completely differently. An unpaid admin passes the first and fails the second.
The practical rule: whenever you mix AND with OR, use brackets. They cost nothing, remove ambiguity and make your intent unmistakable to an examiner.
Three-part conditions
# Valid mark that is also a pass
IF mark ≥ 0 AND mark ≤ 100 AND mark ≥ 40 THEN
# Weekend OR a bank holiday, and the shop is open
IF (isSaturday OR isSunday OR isBankHoliday) AND isOpen THEN
Using NOT
IF NOT found THEN
OUTPUT 'Item not in list'
ENDIF
WHILE NOT finished
…
ENDWHILE
NOT with a Boolean flag reads naturally and is preferred to found = False. Both work; NOT found is cleaner.
NOT applied to a comparison needs brackets:
IF NOT (age ≥ 18) THEN # same as age < 18
This is legal but usually worse than just writing age < 18 directly — write the positive form when you can.
AQA tip. In an exam, over-bracketing is never penalised but under-bracketing can change the meaning entirely. If in doubt, bracket.