Atom

While loops

A while loop repeats while its condition holds. Use it when you know what should stop the loop, but the number of repetitions depends on the work.

Count up to a limit

Advance the counter inside the loop so the condition can eventually become false.

Atom
number = 0

while number < 3:
    print(number)
    number += 1
Output
0
1
2

After printing 2, the counter reaches 3 and the loop stops.