Skip to content

Instantly share code, notes, and snippets.

@heim
Created April 7, 2011 09:54
Show Gist options
  • Save heim/907445 to your computer and use it in GitHub Desktop.
Save heim/907445 to your computer and use it in GitHub Desktop.
def counter(start=0, increment=1)
start -=increment #not cheating
lambda do
start += increment
end
end
result = counter(0, 3)
puts result.call
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