Re: Labeled Loops?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Matt Lewis wrote:
> c.k.lester wrote:
> > or maybe:
> > for a = 1 to 10 do
> >     for b = 1 to 10 do
> >         while 1 do
> >             if b = 3 then exit a end if
> >             if a = 2 then continue b end if
> >         end while
> >     end for
> > end for
> 
> Ok, genius, how do you label a while loop? :P

while 1 label "matt_is_a_poopie_head" do
  ...
  exit "matt_is_a_poopie_head"
end while

Of course, an undefined exit takes you out of the latest loop.

while 1 do
  exit
end while

or something like this:

while 1 do "getrdone"
  while 1 do "inner_while"
    if y then
      exit "getrdone"
    else
      exit "getrdone"
    end if
end while

but I still say for loops need no label. :)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu