Skip to content

Instantly share code, notes, and snippets.

@mauropm
Created March 8, 2013 21:28
Show Gist options
  • Save mauropm/5120023 to your computer and use it in GitHub Desktop.
Save mauropm/5120023 to your computer and use it in GitHub Desktop.
Nice example about lambda usage in ruby #metaprogramming
def n_times(n)
#codigo
lambda {|val| n * val}
end
two_times = n_times(2)
puts two_times.call(3)
#from Norberto's class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment