Learn C Programming

Lesson 4 of 9 · Loops and Jump Statements

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

  1. break: stop the loop the moment you know
  2. continue: skip the rest of one pass
  3. The while trap: continue can skip the step
  4. break inside a switch leaves only the switch
  5. Leaving two loops at once: a flag
  6. goto: legal, rarely right, and the one idiom worth knowing