C++ TutorialLesson 18Free preview
C++ Break/Continue
This lesson is part of C++ · All levels
Summary
This lesson explains the two keywords of the repeat loop controller, break and continue. break stops the repeat or switch earlier, while continue jumps through the rest of the block and proceeds to the next iteration. Both are useful for controlling execution based on certain conditions in the middle of the loop.
Key points
- Break out completely from the repetition (or switch).
- Continue through the rest of the iteration and move on to the next iteration.
- Break is often used to stop a search after a target is found.
- Continue not end the loop, just accelerate to the next iteration.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.