Actions
Bug #1730
closedReturning inside for loop inside lambda crashes
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-linux]
Description
=begin
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
=end
Updated by ujihisa (Tatsuhiro Ujihisa) over 14 years ago
- Status changed from Open to Closed
=begin
This change is intentional. The return behaviours are different between 1.8 and 1.9.
=end
Actions
Like0
Like0