Search⌘ K
AI Features

The break and continue Statements

Explore how break and continue statements influence loop flow in C#. Understand how break exits a loop early while continue skips to the next iteration. This lesson helps you write more efficient loops by controlling when and how iterations run.

What does a break statement do?

Exit a loop early by using the break keyword. In the example below, the program ends when the user guesses the correct number.

Example: ...