Loop Lab: for vs while

Pick a task, then step through both loops line by line. Watch the highlighted line, the variables, the loop check, and the output change on each step.

Programming Beginner Loops · for · while ~8 min
for: you know how many times to repeat while: repeat until something changes

Keyboard: → or N to step, Space to run or pause, R to reset.

Which loop fits?

0 / 8