From: Evan Farrar Date: 2009-03-20T02:36:15+09:00 Subject: Re: Initializing an NxN array Evan Farrar wrote: > Since * is defined on array, you can start with a 1x1 array and multiply > to the size you need. > > > n = 3; > ary = [[0]*n]*n > > results in: > ary => [[0, 0, 0], [0, 0, 0], [0, 0, 0]] whoops! that has the same problem mentioned above: irb(main):026:0> ary[0][0] = :foo; ary => [[:foo, 0, 0], [:foo, 0, 0], [:foo, 0, 0]] I retract! -- Posted via http://www.ruby-forum.com/.