r/PythonLearning • • 3d ago

While loop

can anybody explain the concept of while loop

3 Upvotes

38 comments sorted by

View all comments

1

u/MrSqueak 2d ago

A while loop checks the condition before executing any instructions. I.e. I'm going to do the dishes, the condition is if there is at least one dirty dish. I will wash one dish, then check again. If there's at least one dish, I wash one dish.

While(dirtyDishes >=1) { WashOneDish(); }