Skip to content

Instantly share code, notes, and snippets.

@seesmith
Created April 7, 2011 10:12
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 seesmith/907486 to your computer and use it in GitHub Desktop.
Save seesmith/907486 to your computer and use it in GitHub Desktop.
scottish ruby conference tutorial counter code
def counter(start, increment)
lambda do
current = start
start += increment
current
end
end
result = counter(2,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