Skip to content

Instantly share code, notes, and snippets.

@nrocy
Created April 7, 2011 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nrocy/907467 to your computer and use it in GitHub Desktop.
Save nrocy/907467 to your computer and use it in GitHub Desktop.
ruby stuff
def counter(start=0, increment=1)
total = start - increment
lambda do
total += increment
end
end
result = counter(10,2)
puts result.call
puts result.call
puts result.call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment