Hi,

Am Freitag, 07. Jan 2005, 01:41:30 +0900 schrieb Sea&Gull:
> Bertram Scharpf wrote:
> >Anyway, I would have liked to know, what 'next <exp>' means.
> >Never mind; in the meantime I found out.
> 
> This C code may illustrate how "next", "break", "redo" behave
> in Ruby:
> 
> while (condition) {
>  label_redo:
> 
>    goto label_next;        /* next */
>    goto label_break;       /* break */
>    goto label_redo;        /* redo */
> 
>    /* some code */
> 
>  label_next:
> 
> }
> 
> label_break:
> 

The question was not where execution continues but what
happens with an expression given after `next'.

I think this behaviour has to do with an other aspect:

    def f ; yield ; end
    def g ; 5.times { |i| f { break }; print i, '-' } ; end
    puts g

So, `break' etc. do not actually leave loops but just
communicate with the calling `yield' that does the jump, to
the end of the surrounging loop or function, whatever comes
next.

Please blame me if I'm wrong.

Bertram

-- 
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de