Hi,

On Mon, 9 Dec 2002 07:23:22 +0900
"Shashank Date" <sdate / kc.rr.com> wrote:

> > I tried the following
> > a=Array.new(3,Array.new(2,Array.new))
> > p a
> >
> > out put is:
> > [[[ ], [ ]], [[ ], [ ]], [[ ], [ ]]]
> 
> Correct ! It did what you asked it do ... reading Array.new from inside out:
> First create an Array object with no elements (like [])
> Then use it as the initial value of another Array object with 2 elements.
> Then use this as the initial value of the final Array object with 3
> elements.
> 
> Hence:
> 
>  [[[ ], [ ]], [[ ], [ ]], [[ ], [ ]]]
> 
> Moreover, if you tried:
> 
> a[0][0][0] = 1
> p a
> 
> you would now get
> 
> [[[1], [1]], [[1], [1]], [[1], [1]]]
> 
> Surprised, eh ?
I'm indeed surprised by this piculiar behavior.  I used the solution you
suggested, it worked fine. tks. But I don't understand why?

Shannon