Re: Labeled Loops?

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

Jeremy Cowgar wrote:
> 
> CChris wrote:
> > 
> > }}}
<eucode>
> > label "my_loop"
> > for i=1 to n do
> > while 1 do
> > while f(x)=3 do
> > ---....
> > if done() then
> >   exit "my_loop"
> > end if
> > end end end
> > </eucode>
{{{

> > 
> 
> Hm... what about:
> 
> }}}
<eucode>
> for a = 1 to 10 label "top" do
>     for b = 1 to 10 label "mid" do
>         while 1 do
>             if b = 3 then exit "top" end if
>             if a = 2 then continue "mid" end if
>         end while
>     end for
> end for
> </eucode>
{{{

> 
> A terrible loop example, but the ability to label loops. The addition of this
> labeling and exit/continue to those labels is cake.
> 
> This is just me thinking aloud again once seeing Chris's example code. I kind
> of really like this idea. What about you? label is obviously optional, just
> as "by" is on a for loop. The implementation of such would allow you to reuse
> labels in non related loops and again, would cause no slow down what-so-ever
> if used or not used.
> 
> --
> Jeremy Cowgar
> <a href="http://jeremy.cowgar.com">http://jeremy.cowgar.com</a>

Actually that's how "label" is used in Æ with no gotoes...

CChris

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

Search



Quick Links

User menu

Not signed in.

Misc Menu