Skip to content

Instantly share code, notes, and snippets.

@nbfritz
Created December 14, 2012 14:57
Show Gist options
  • Select an option

  • Save nbfritz/4286003 to your computer and use it in GitHub Desktop.

Select an option

Save nbfritz/4286003 to your computer and use it in GitHub Desktop.
Ruby Hash Post - Part 1: working counter hash
counter = Hash.new(0) # => {}
counter[:monkey] += 1 # => 1
counter[:monkey] += 2 # => 3
counter # => {:monkey => 3}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment