From: bugmenot bugmenot Date: 2009-07-05T18:21:36+09:00 Subject: [ruby-core:24148] [Bug #1730] Returning inside for loop inside lambda crashes Bug #1730: Returning inside for loop inside lambda crashes http://redmine.ruby-lang.org/issues/show/1730 Author: bugmenot bugmenot Status: Open, Priority: Normal ruby -v: ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-linux] This code: foo = lambda do for j in 1..2 return end end foo.call crashes with a LocalJumpError: test.rb:3: unexpected return (LocalJumpError) from test.rb:2:in `each' from test.rb:2 from test.rb:6:in `call' from test.rb:6 Why does it do this? However, it seems to run fine on Ruby 1.9. It's not just an issue of returning inside a lambda; without the for-loop it runs fine: foo = lambda do return end foo.call ---------------------------------------- http://redmine.ruby-lang.org