Read from the top and stop
Each card has a number and is either marked or not. The rule is a list of branches. Read it from the top. The first condition that is true for the card sends it to that branch, and every branch below is skipped. If no condition is true, the card goes to the last branch, the one that starts with Otherwise.
Read each condition exactly. “5 or more” includes 5. “Above 5” does not. “5 or less” includes 5 too.
AND needs both checks to pass. OR needs at least one, and both passing counts as well.
1Start with branch A.
2Test the whole condition, boundaries included.
3Stop at the first condition that is true.
Four cards, one rule
Card A is 9. 9 is 7 or more, so it stops at A. Its mark is never checked.
Card B is 5. 5 is not 7 or more, so test the next branch. Card B is marked, so it goes to B.
Card C is 7. “7 or more” includes 7, so it goes to A.
Card D is 3 and not marked. Neither condition is true, so it goes to C.
An AND at the top
The first branch joins two checks with AND. Test both, then move on only if it fails.
Try it
Which branch does card A go to?
- Branch A
- Branch B
Show the answer
Branch B
Right. The first branch fails on its second check, because 6 is not 4 or less. The next branch, 6 or more, includes 6, so the card stops at B.
Enable JavaScript to answer interactively and save your place.
Practice Follow the rule