Re: goto: it's conceded

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

Kat wrote:
> 
> Derek Parnell wrote:
> > 
> > David Cuny wrote:
> > > Well, sometimes you're nested deep, and you need to get out. Implementing
> > > it
> > > 
> > > without GOTO is messy and error prone. With GOTO, it's clear
> > > what's happening and it executes as expected.
> > 
> > We can now do this (in V4.0) ...
> > 
> >    while cond1 label "toplevel" do
> >       . . .
> >       while cond2 do
> >        . . .
> >          while cond3 label "anotherpoint" do
> >            . . .
> >             while cond4 do
> >               . . .
> >               if abc then
> >                   exit "toplevel"
> >               else
> >                   continue "anotherpoint"
> >               end if
> >             end while
> >         end while
> >      end while
> >    end while
> > 
> 
> Why did you
> exit "toplevel"
> else
> continue "anotherpoint"
> 
> and not
> continue "toplevel"
> else
> continue "anotherpoint"

Because I wanted to exit the top level and not begin the next iteration of it.

> or 
> goto "toplevel"
> else
> goto "anotherpoint"

Where is "toplevel"? Is it above or below the goto? I don't know so I'll have to
check the code. Oh there it is ... it's above. But I don't want to GOTO that
label, I want to leave the loop called "toplevel" instead.

Where is "anotherpoint"? Is it above or below the goto? I don't know so I'll
have to check the code. Oh there it is ... it's above. But I don't want to GOTO
that label, I want to begin the next iteration of the loop called "anotherpoint"
instead.


-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

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

Search



Quick Links

User menu

Not signed in.

Misc Menu