Skip to content

Instantly share code, notes, and snippets.

@simsicon
Created November 12, 2013 06:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simsicon/7426316 to your computer and use it in GitHub Desktop.
Save simsicon/7426316 to your computer and use it in GitHub Desktop.
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
Copy link
Author

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