Skip to content

Instantly share code, notes, and snippets.

@scashin133
Created November 25, 2009 17:53
Show Gist options
  • Save scashin133/242904 to your computer and use it in GitHub Desktop.
Save scashin133/242904 to your computer and use it in GitHub Desktop.
def foo
f = Proc.new { return "return from foo from inside proc" }
f.call # control leaves foo here
return "return from foo"
end
def bar
f = lambda { return "return from lambda" }
f.call # control does not leave bar here
return "return from bar"
end
puts foo # prints "return from foo from inside proc"
puts bar # prints "return from bar"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment