Skip to content

Instantly share code, notes, and snippets.

@ukstudio
Created March 9, 2009 04:10
Show Gist options
  • Select an option

  • Save ukstudio/76098 to your computer and use it in GitHub Desktop.

Select an option

Save ukstudio/76098 to your computer and use it in GitHub Desktop.
# coding: UTF-8
def counter_closer
count = 0
lambda{|n| count += n}
end
counter = counter_closer
puts counter.call(1)
puts counter.call(2)
puts counter.call(3)
puts counter.call(4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment