27 Dec
2006
27 Dec
'06
5:05 a.m.
David Blaschke schrieb:
Using break for parent, grandparent, etc. only works until someone modifies the code incorrectly. It is a problem waiting to happen. Mathias' suggestion breaks the outer loop, but a slight modification allows you to break any one of the loops
"Well this is a good way to break the outer most loop without any new syntax:" cond1 = 1 cond2 = 1 cond3 = 1 while cond1: while cond2: while cond3: if cond4: cond2 = 0 ## break second loop, etc
of course you could do it this way. then you could also say, what is "break" and "continue" good for at all? I think its a matter of taste (not good or bad taste, just different)