Is there a "do ... until" in Python? [duplicate]
Is there a
do until x:
...
in Python, or a nice way to implement such a looping construct?
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
I prefer to use a looping variable, as it tends to read a bit nicer than just "while 1:", and no ugly-looking break
statement:
finished = False
while not finished:
... do something...
finished = evaluate_end_condition()