Is there a "do ... until" in Python?

Matt Joiner picture Matt Joiner · Nov 2, 2009 · Viewed 375.9k times · Source

Is there a

do until x:
    ...

in Python, or a nice way to implement such a looping construct?

Answer

theycallmemorty picture theycallmemorty · Nov 2, 2009

There is no do-while loop in Python.

This is a similar construct, taken from the link above.

 while True:
     do_something()
     if condition():
        break