Breaking out of nested loops

Ulf Magnusson ulf.magnusson at ubm-computing.com
Sat Jan 12 15:44:27 EST 2002


"Chris Liechti" <cliechti at gmx.net> wrote in message
news:Xns9194B718F5FA2cliechtigmxnet at 62.2.16.82...
> "Ulf Magnusson" <ulf.magnusson at ubm-computing.com> wrote in
> news:w7Y%7.12719$l93.2807512 at newsb.telia.net:
>
> > I guess you mean something like this
> > ******************
> > for i in ...:
> >     for j in ....:
> >          if some_condition:
> >                 magic_break
> > code continues here...
> > ******************
> >
> > There are not supposed to be such a magical break, to my knowledge no
> > other language support this either. It kind of breaks the good
> > behaviour you expect from a imparative programming language.
>
> Java does support this!
>
> loop1:
>     for(;;) {
>         for(;;) {
>             ...
>             if (...) break loop1;
>         }
>     }
>
> (the labels only work with break statements there is no goto in java.)
>

However, this is just syntactic suger for a goto.... (ugh :-)






More information about the Python-list mailing list