else clauses in while and for loops

Jason Stokes jstok at bluedog.apana.org.au
Sat Mar 25 11:55:18 CET 2000


Tomek Lisowski wrote in message ...
>Hi!
>
>Which is the reason for else clauses in while and for loops?

>From the Python language reference, section 7.2:

 A break statement executed in the first suite
 terminates the loop without executing the else
 clause's suite.

And from 7.3:

 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 continues
 with the next item, or with the else clause if there
 was no next item.








More information about the Python-list mailing list