Curriculum

Curriculum

Write a Boundary Example Before Coding

Scenario

Library checkout allows borrowing only when a reader currently has fewer than 3 books.

Selected choicePick a choice below
Result—

Try it yourself

Compare the three neighbors around the 3-book limit.

Reveal the explanation
  1. borrowedCount = 2 (just below limit)

    Allowed (true). One more book brings the reader to 3.

  2. borrowedCount = 3 (exact limit)

    Declined (false). "Fewer than 3" excludes 3 itself.

  3. borrowedCount = 4 (above limit)

    Declined (false). Already over the limit.

Testing only 0 and 10 would miss a buggy <= 3 check. Writing 2, 3, and 4 by hand first makes off-by-one errors impossible to overlook.

Download shared test cases

Your turn

Write a three-neighbor hand example for a workshop requiring at least 10 minutes of check-in buffer.

Common mistake Testing 0 minutes and 30 minutes while skipping 9, 10, and 11.

Check your work

9 → Declined, 10 → Accepted, 11 → Accepted.

Quick check

Which three values form the tightest boundary triplet for "free delivery when order items >= 5"?
Show the answer and reasoning

Correct answer 4, 5, and 6

4 (just below), 5 (exact boundary), and 6 (just above) verify both the threshold and whether it is inclusive.