Todd Matsumoto wrote:
while True:
    <do something>
    for i in items:
        if i > 10:
            break
        else:
            <do something>


> Okay,
>
> So how would you break out from this situation?
>

finished = False
while not finished:
     <do something>
     for i in items:
         if i > 10:
             finished = True  # Do not do the next while-iteration
             break            # and break out of the for loop
         else:
             <do something>

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to