From: "Ondřej Bílka" Date: 2012-01-14T00:05:24+09:00 Subject: [ruby-core:42118] Re: [ruby-trunk - Feature #5893][Open] named return,next... On Fri, Jan 13, 2012 at 11:34:17PM +0900, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: [ruby-core:42115] Re: [ruby-trunk - Feature #5893][Open] named return,next..." > on Fri, 13 Jan 2012 23:26:36 +0900, Ond��ej B��lka writes: > > |> Doesn't throw/catch to that already? > |No unless you are happy with passing result by global variable. > > Have you ever tried? throw can pass the result to catch. > > matz. I did not know this one. In code I have seen it is typically something like this. def return_it(foo) $foo=foo throw(:my_constant) end $foo=nil t=try(:my_constant){ yield } t=$foo if $foo