M
Marcello Barnaba
h = Hash.new({})
=> {}
??
=> {}
=> []h[:a][:b] = 1 => 1
h => {}
h[:a] => {:b=>1}
h.keys => []
h.values
??
=> []h[:a][:b] = 1 => 1
h => {}
h[:a] => {:b=>1}
h.keys => []
h.values
Marcello said:=> []h = Hash.new({}) => {}
h[:a][:b] = 1 => 1
h => {}
h[:a] => {:b=>1}
h.keys => []
h.values
??
You are assigning to the {}, gotten by the [:a]h = Hash.new({}) => {}
h[:a][:b] = 1
If obj is specified, this single object will be used for all default
values.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.