C# TutorialLesson 19Free preview
C# Break/Continue
This lesson is part of C# · All levels
Summary
Break stops the repetition completely, while continue jumping through the rest of the running iteration and then continue on to the next iteration. Both are useful for dealing with special cases without stacking up on the fussy if conditions. Break also functions to exit the switch block in addition to the repetition.
Key points
- Break out of the deepest repetition where it is.
- Continue past the rest of the iteration block and then move on to the next iteration.
- Inside the switch, the break serves to close a case.
- Excessive use of break and continue can make programming difficult to read.
- Similar logic can often be rewritten with cleaner loop conditions.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.