Hi --

On Mon, 9 Dec 2002, Shashank Date wrote:
> So the other approach is:
>
> arr = Array.new(2)
> arr.each_index { |i|
>     r = Array.new(2)
>     r.each_index { |j|
>         r[j] = 0
>     }
>     arr[i] = r
> }
> p arr
>
> will give you:
>
> [[0,0],[0,0],[0,0]]

You're doing too much work -- let Ruby do it :-)

  arr = (1..3).map { [0,0] }


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav