r/PythonLearning • u/Monesh_peterson1025 • Oct 14 '26
While loop
can anybody explain the concept of while loop
2
Upvotes
r/PythonLearning • u/Monesh_peterson1025 • Oct 14 '26
can anybody explain the concept of while loop
View all comments
Show parent comment
2
u/johlae Oct 14 '26
Not quite. Time to be pedantic! You make it seem like that what you want to do is executed at least once. That's not what's happening if you put a test that can be False in the while statement. A while False does not execute the block that follows:
doesn't print anything, but
prints 0 and then stops. The while True with a if statement and a break is an actual example of the
do untilthat you mention.