Introduction
A while loop helps repeat actions as long as something is true. It saves time and avoids writing the same code again and again.
When you want to keep asking a user for input until they give a correct answer.
When you want to keep running a game until the player loses or quits.
When you want to repeat a task until a certain condition changes, like counting down to zero.
When you don't know how many times you need to repeat something before starting.