Card 09/ 09

RecapDifficulty: Intermediate1 min

One Decision, One Repetition, and the Boundary in Each

Five things this topic established, and where each one was.

What the topic established, and which card it was on
The thingWhere
An if ladder tests a condition per rung; a switch matches one valueMaking the Program Take One Path and Not the Other
If every rung compares the same variable to a constant, it is a switchWhen to Reach for switch and When for else if
Four loop forms, separated by how much you know before the loop startsThe Four Shapes of a Java Loop
A counter from zero compares with <; a counter from one compares with <=Why Your Retry Policy Tried Four Times
The colon form of switch picks a starting point, not a branchWhy a switch Without break Keeps Going

The one worth carrying: in both halves of this topic the bug lives at the boundary rather than in the body. A counter that is one out and a missing break are the same kind of mistake — the code ran one step further than you read it as running.