Lesson 3/6 · Graduation exam preparationNot startedhigh School~90 min

The while loop

A loop that runs while a condition holds: counting down, skipping numbers, reading repeatedly until an end value, and handling bad input.

After this lesson you'll be able to:

  • Write a `while` loop with and without a counter
  • End a loop with `break` and skip a step with `continue`
  • Avoid an infinite loop

Theory (PDF)

The theory for this lesson is being prepared.

Examples to try

Your code runs only in this browser, in an isolated environment with no access to the internet or your account.

Examples for this lesson are being prepared.