Skip to content

Instantly share code, notes, and snippets.

@jeffreyiacono
Created January 14, 2013 01:33
Show Gist options
  • Select an option

  • Save jeffreyiacono/4527192 to your computer and use it in GitHub Desktop.

Select an option

Save jeffreyiacono/4527192 to your computer and use it in GitHub Desktop.
using blocks and lambdas
def ampersandy(n)
yield n
end
ampersandy(10) do |x|
x + 10
end
# => 20
l = lambda { |x| x + 10 }
ampersandy(15, &l)
# => 25, neat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment