Skip to content

Instantly share code, notes, and snippets.

@simsicon

simsicon/proc.rb

Created Nov 12, 2013
Embed
What would you like to do?
LocalJumpError
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
@simsicon

This comment has been minimized.

Copy link
Owner Author

@simsicon simsicon commented Nov 12, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment