I was doing some practice and play with Hash default value as written in
the documentation.


h = Hash.new([])
h[:a] << 2
h[:a] << 3
h[:a] # => [2, 3]

Till above is perfect.

h # => {}

Why the Hash h is empty hash here?

h[:b] << 2
h[:b] # => [2, 3, 2]

How h[:b] is `[2, 3, 2]` instead of only `[2]` ?

-- 
Posted via http://www.ruby-forum.com/.