Module 6 · Loops and Jump Statements
break, continue, and the goto You Will Not Use
Free with an accountReading
David is searching a long list of numbers for the first 7. His loop finds it on the second number, and then keeps reading.
Checking what this lesson needs for you…
What is inside break, continue, and the goto You Will Not Use
- break: stop the loop the moment you know
- continue: skip the rest of one pass
- The while trap: continue can skip the step
- break inside a switch leaves only the switch
- Leaving two loops at once: a flag
- goto: legal, rarely right, and the one idiom worth knowing