Created
November 12, 2013 06:16
-
-
Save simsicon/7426316 to your computer and use it in GitHub Desktop.
LocalJumpError
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def inner_proc | |
_proc = Proc.new {return 42} | |
puts _proc.call | |
end | |
def outter_proc(_proc) | |
puts _proc.call | |
end | |
inner_proc # => 42 | |
proc = Proc.new {return 42} | |
outter_proc(proc) # => LocalJumpError: unexpected return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The context outter_proc was calling can not return, the same as defining proc into a method, method has return, but you cant return from an exited method.