Slide 1 / 14
Why use `while` instead of `for`?
The for loop is great when you know in advance how many times to repeat.
But what about: "Keep asking the user for a number until they enter 0"? You don't know how many times they'll enter numbers!
The `while` loop is designed for exactly this situation — it repeats as long as a condition is true, without knowing in advance how many iterations are needed.