Skip to content

Instantly share code, notes, and snippets.

@sneeu
Created April 7, 2011 09:56
Show Gist options
  • Save sneeu/907448 to your computer and use it in GitHub Desktop.
Save sneeu/907448 to your computer and use it in GitHub Desktop.
def counter(start=0, increment=1)
i = start - increment # Smells
lambda do
i += increment
end
end
result = counter(10, 2)
5.times do
puts result.call
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment