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.
Sign in to read
This lesson is free, with an account
An account costs nothing and opens every lesson in this track that is not marked Pro, on every device you read on.
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