Joel VanderWerf <vjoel / path.berkeley.edu> wrote:

> matt neuburg wrote:
> > Guoliang Cao <gcao / vonage.com> wrote:
> > 
> >> def test
> >>   puts 'before'
> >>   yield 2
> >>   puts 'after'
> >> end
> >>
> >> test do |i|
> >>   XXX if i > 1
> >>   # a lot of code appears below
> >> end
> >>
> >>
> >> I have code above and wonder if it is possible to use
> >> return/break/anything to stop execution of block and return control to
> >> test() to execute code after yield. I know it is impossible in 1.8.
> > 
> > Why is it impossible? Doesn't "break" do what you need? (And remember,
> > "break" and "next" can even return a value from a block to the yielder.)
> 
> Nope, break will skip the "after" line.

Right, sorry about that. m.

-- 
matt neuburg, phd = matt / tidbits.com, http://www.tidbits.com/matt/
Leopard - http://www.takecontrolbooks.com/leopard-customizing.html
AppleScript - http://www.amazon.com/gp/product/0596102119
Read TidBITS! It's free and smart. http://www.tidbits.com