Take the first branch that fits

Test the conditions from the top, boundaries included, and stop at the first true one

Read from the top and stop

AIf number is 7 or more, use A.BOtherwise, if card is marked, use B.COtherwise, use C.
Two conditions, then a branch for every other card.

Each card has a number and is either marked or not. The rule is a list of branches. Read it from the top.

More

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.

Lesson help

Test each condition whole, boundaries included, and stop at the first one that is true.

About this lesson

Try the method in a practice when you are ready.

Report

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.

AIf number is 7 or more, use A.BOtherwise, if card is marked, use B.COtherwise, use C.
Two conditions, then a branch for every other card.

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.

AIf number is 7 or more, use A.BOtherwise, if card is marked, use B.COtherwise, use C.Card A9MarkedCard B5MarkedCard C7Not markedCard D3Not marked
Cards A and C go to A, card B to B, and card D to C.

An AND at the top

The first branch joins two checks with AND. Test both, then move on only if it fails.

AIf (card is marked) AND (number is 4 or less), use A.BOtherwise, if number is 6 or more, use B.COtherwise, use C.Card A6Marked
One card, three branches.

Try it

Which branch does card A go to?

  1. Branch A
  2. 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

Sign in free

Practice without limits and keep your progress.