do-while loop?

Charles Cazabon c_cazabon at
Fri Mar 24 04:12:59 CET 2000

Peter Bittner claimed in <38DAD9A8.CF0FC4AF at>:

>I'm missing a 'do-while' statement in Python.
>There's only 'for' and 'while' available, but how do I implement a loop
>that has to be executed at least once?
>Do I have to go the ungly way and state the same code before the loop?

No.  Try this:

while 1:
    	do stuff here
    	if (end condition):  break


More information about the Python-list mailing list