If you specify a parameter for Hash.new the SAME object will be used for any default value (see documentation). If you modify it, it will be modified for all default values afterwards. Try to see what the value will be returned for r[:a] if you do it again. I bet it will be {:c => 10}. As well as for r[:c], r[10] and so on. Gennady. On Aug 28, 2005, at 21:16, Trans wrote: > irb(main):006:0> def r > irb(main):007:1> @r ||= Hash.new({}) > irb(main):008:1> end > => nil > irb(main):009:0> r[:a] > => {} > irb(main):010:0> r[:b][:c] = 10 > => 10 > irb(main):011:0> r > => {} > irb(main):012:0> r[:b] > => {:c=>10} > irb(main):013:0> > > Please explain how r is empty but r[:b] exists. Thank You. > > T. > > >