Created
April 7, 2011 09:56
-
-
Save bgswan/907447 to your computer and use it in GitHub Desktop.
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 counter(start=0, increment=1) | |
lambda do | |
puts start | |
start += increment | |
end | |
end | |
result = counter(10, 2) | |
result.call # 10 | |
result.call # 12 | |
result.call # 14 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment