From: Sea&Gull Date: 2005-01-08T04:11:29+09:00 Subject: Re: Return from a block? > The question was not where execution continues Sorry, I did not undestand you clearly :) > but what > happens with an expression given after `next'. What do you mean asking "what happens"? > 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 *Perhaps*, your task may be solved by a tad redesign of control structures: def f(i); yield i; end def g 5.times { |i| break if f(i){|i| i == 3} print i, '-' } puts "\nEnd of g" end puts g > So, `break' etc. do not actually leave loops They "leave" _current_ block. In the example you gave above "break" leaves the block "{ break }". > but just > communicate with the calling `yield' afaik, "yield" neither here not there. It does not influence on the behaviour of "break". > that does the jump, to > the end of the surrounging loop or function, whatever comes > next. > > Please blame me if I'm wrong. > > Bertram > -- s&g