From: Ryan Davis Date: 2011-08-03T05:31:43+09:00 Subject: Re: Documentation Improvement Proposal On Aug 2, 2011, at 13:10 , Josh Vaughn wrote: > Example that I did just yesterday. > > ary = Array.new(r, Array.new(10)) > vs > ary = Array.new(10) { Array.new(10) } > > Seemingly the same, but they are not. User documentation might say the best way to do multi-dimensional array. Note I am learning and tried the first as I found that Array.new(some initial size, some initial value) was the basic Array API. It does say how to do it: % ri Array ... # only one copy of the object is created a = Array.new(2, Hash.new) a[0]['cat'] = 'feline' a a[1]['cat'] = 'Felix' a # here multiple copies are created a = Array.new(2) { Hash.new } a[0]['cat'] = 'feline' a ...