Skip to content

Instantly share code, notes, and snippets.

@shinkbr
Created May 14, 2015 10:16
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 shinkbr/08e9e3cc32f9c275c34e to your computer and use it in GitHub Desktop.
Save shinkbr/08e9e3cc32f9c275c34e to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# coding: utf-8
h1 = Hash.new(0)
h1[:a] += 1
p h1 #=> {:a=>1}
h2 = Hash.new({a: 0})
h2[:a][:a] += 1
p h2 #=> {}
p h2[:a] #=> {:a=>1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment