/test/non_local_return.rb
http://github.com/feyeleanor/RubyGoLightly · Ruby · 18 lines · 13 code · 2 blank · 3 comment · 0 complexity · 03bcbbaf92d073b6eb590d6e6f34ae32 MD5 · raw file
- def yielder
- yield
- end
- def non_local_return
- yielder do
- puts "ok"
- return 1
- puts "nop"
- end
- puts "should not get here"
- end
- puts non_local_return
- puts "end"
- # => ok
- # => 1
- # => end