while semantics
Grant Edwards
grante at visi.com
Thu Mar 13 19:26:42 EST 2003
More information about the Python-list mailing list
Thu Mar 13 19:26:42 EST 2003
- Previous message (by thread): while semantics
- Next message (by thread): while semantics
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In article <b4r6eh$oj4$2 at news.asu.edu>, David Bear wrote: > I think I'm confusing myself regarding semantics for a while loop. > > while (conditionX): > do something > while (conditionY): > do something else > while (conditionZ): > do something > here conditionX becomes False > print something > print something else > > Will the outer while loop cause all nested whiles to end as soon as > conditionX is false? No. conditionX will only be checked once per "outer loop". If you're in one of the inner loops, you stay there until that loop's condition is false. > or will 'print something' be reached, then 'print > something else' and so on untill it reaches the outer scope? Neither. You'll stay inside in Z loop until conditionZ becomes false. Then you'll stay in the Y loop until conditionY becomes false. After both the Z and Y loops have terminated, conditionX will be checked again. -- Grant Edwards grante Yow! TATTOOED MIDGETS at are using ALFREDO in their visi.com SALAMI FACTORY!
- Previous message (by thread): while semantics
- Next message (by thread): while semantics
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list