The break and continue Statements

Let's learn about two useful statements in loops.

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.

Get hands-on with 1200+ tech skills courses.