Loop until condition is true

Peter Otten __peter__ at web.de
Sat Jun 18 09:19:42 CEST 2005


Donn Cave wrote:

> If you look at C code, at least in my experience the
> "until" loop is quite rarely used.  (I don't see it once in the source
> to Python 2.4, for example.)

Long time no C? 

'until' in C is actually 

do 
    statement
while (expression);

I found 136 occurrences of "do {" versus 754 of "while (" and 1224 of "for
(" in the Python 2.4 source, so using these rough estimates do-while still
qualifies as "rarely used".

Peter




More information about the Python-list mailing list