Equivalent of Do-While?

Erik Max Francis max at alcyone.com
Thu Nov 6 04:49:24 CET 2003

Code_Dark wrote:

> Hi, I'm coming over to python from C and C++, and I was just wondering
> if there's an equivalent of the Do-While fuction that I'm so fond
> of... I really like it, and it's handy for asking the user if they'd
> like to repeat a program (or parts of a program).

Use something like

	while True:
	    ... do something ...
	    if not condition:
	    ... do something more ...

   Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
 __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/  \ The color is red / Under my shoe
\__/  Neneh Cherry

More information about the Python-list mailing list