Breaking out of nested loops
Chris Liechti
cliechti at gmx.net
Sat Jan 12 11:57:13 EST 2002
"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.)
--
Chris <cliechti at gmx.net>
More information about the Python-list
mailing list