When you don't know in advance how many repetitions you need, a for loop isn't enough. You'll learn to write while loops driven by conditions, steer them precisely with break and continue, and build robust validation loops that examine stored candidate data until an acceptable value is found.
Overview
Syllabus
- Unit 1: Controlling Repetition with While Loops
- Count the Workout Laps
- Loop Until the Debt Clears
- Count the Doublings Past a Limit
- Stop the Endless Tank Drain
- Unit 2: Controlling Loops with Break
- Stop the City Search Early
- Stop Logging at the Sentinel
- Stop at the First Warm Reading
- Report When No Reading Matches
- Unit 3: Skipping Iterations with Continue
- Total Only the Positive Readings
- Skip the Damaged Parcel Labels
- Count the Even Tickets
- Fix the Frozen Shift Log
- Unit 4: Validating Data with Loops
- Find the First Valid Sensor Reading
- Find the First Acceptable Box Weight
- Find the First Valid Command
- Find the First Usable Label