PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/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
 1def yielder
 2  yield
 3end
 4
 5def non_local_return
 6  yielder do
 7    puts "ok"
 8    return 1
 9    puts "nop"
10  end
11  puts "should not get here"
12end
13
14puts non_local_return
15puts "end"
16# => ok
17# => 1
18# => end