Computer Science · Ch 6 — Flow of Control
Break and Continue Statement
6.5
Break and Continue Statement
Looping constructs let a programmer repeat tasks efficiently — but sometimes the normal round-and-round flow of a loop needs to be interrupted. Two situations arise when a particular condition occurs mid-loop:
- We may want to exit the loop altogether — come out of it forever — even though its condition is still true.
- We may want to skip the remaining statements of the current pass and move on within the loop. …