Skip to content

Instantly share code, notes, and snippets.

@heronmedeiros
Created April 26, 2011 17:56
Show Gist options
  • Save heronmedeiros/942750 to your computer and use it in GitHub Desktop.
Save heronmedeiros/942750 to your computer and use it in GitHub Desktop.
Ruby Closure
def make
return lambda do |x|
return lambda do |y|
return x + y
end
end
end
puts make.call(1).call(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment