Preview
IB DP Computer Science — B2 Programming — Programming constructs | SL | B2.3.3
📋 What You Will Learn
- Distinguish counted (for) loops from conditional (while) loops and choose the appropriate type
- Construct both loop types in pseudocode, Java and Python
- Use Boolean and relational operators in loop conditions, including sentinel and validation loops
- Combine selection statements inside loops to process only the values that match a condition
- Trace loops accurately with a trace table, including start, update and termination
🔁 Why This Matters "Do 20 press-ups" and "stir until the sauce thickens" are both repetition — but the first knows its count in advance and the second repeats until a condition changes. Every loop you will ever write is one of these two, and picking the wrong one is the root of most loop bugs.
Two Types of Loop
Counted loops — the number of