RE: A Euphoria wish list item (minor)

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

Kat wrote:
> On 15 Feb 2002, at 20:49, Andy Serpa wrote:
> 
> > 
> > While everyone is fighting about the future of the languange, I have a 
> > minor suggestion that I would find quite convienient:
> > 
> > Modify the "exit" statement so I can break out of nested loops, like the 
> > 
> > "break" statement in PHP.
> > 
> > So "exit" would become shorthand for "exit(1)", while "exit(2)" would 
> > break out of two loops, "exit(3)" would break out of 3, etc...
> 
> Ewwwwwww!
>  
> > Currently, I have to do something like this:
> > 
> > for i = 1 to 10 do
> >   for j = 1 to 10 do
> >     -- do whatever
> >     if some_sequence[i][j] = whatever then
> 
> then goto nextstep
> 
> >        exit_flag = TRUE
> >        exit 
> >     end if
> >   end for
> >   if exit_flag = TRUE then
> >     exit 
> >   end if
> > end for
> 
> :nextstep:
>  
> > ...wheras a nice "exit(2)" inside the j loop would do nicely...
> 
> So does goto.
> 

Actually, the only thing I'd ever use goto for is to bust out of nested 
loops.  Other than that, I don't like it...

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

Search



Quick Links

User menu

Not signed in.

Misc Menu