Created
April 26, 2011 17:56
-
-
Save heronmedeiros/942750 to your computer and use it in GitHub Desktop.
Ruby Closure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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