Skip to content

Instantly share code, notes, and snippets.

@ngpestelos
Last active December 23, 2015 10:29
Show Gist options
  • Save ngpestelos/6621455 to your computer and use it in GitHub Desktop.
Save ngpestelos/6621455 to your computer and use it in GitHub Desktop.
returning from a lambda
# see Metaprogramming Ruby, p. 80
def double(callable_object)
callable_object.call * 2
end
l = lambda { return 10 }
puts double(l) # 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment