Skip to content

Instantly share code, notes, and snippets.

@kjwierenga
Created April 7, 2011 09:53
Show Gist options
  • Save kjwierenga/907443 to your computer and use it in GitHub Desktop.
Save kjwierenga/907443 to your computer and use it in GitHub Desktop.
def counter(start, inc)
lambda do
current = start
start += inc
current
end
end
result = counter(10, 2)
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