do .. while loops ?

Peter Renzland N010715clp at dancing.org
Sun Jul 15 07:59:15 CEST 2001


Paul Andreassen wrote on Sun, 15 Jul 2001 14:00:31 +1000:
> 
> Could someone please tell me why "do .. while" loops are not part of the
> python language?

http://www.python.org/doc/current/ref/while.html :

7.2 The while statement 

The while statement is used for repeated execution as long as an
expression is true: 

    while_stmt:     "while" expression ":" suite
                   ["else" ":" suite]

This repeatedly tests the expression and, if it is true, executes the
first suite; if the expression is false (which may be the first time it
is tested) the suite of the else clause, if present, is executed and the
loop terminates.

A break statement executed in the first suite terminates the loop without
executing the else clause's suite. A continue statement executed in the
first suite skips the rest of the suite and goes back to testing the
expression.

-- 
Peter Renzland    o   Planix Inc.  Toronto, Ontario, Canada   _ at _      {)/'
       .^.       \_/  Unix Internet Security Administration  /\ /\_._,(_/  
       _!_       _|_  Consulting -- Training -- Programming '  \      /_\  
        !         |   ....... Je danse donc je suis .......    /)    /(    



More information about the Python-list mailing list