[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: multimimensional arrays - i am not getting it..

seebs

5/18/2007 9:30:00 PM

In message <bcda57230145bdb94ab5011f83a1a769@ruby-forum.com>, Sergio Ruiz writes:
>>> a = Array.new(3,[])
>=> [[], [], []]
>>> a[2] << "check"
>=> ["check"]
>>> a
>=> [["check"], ["check"], ["check"]]
>
>this is totally not what i am expecting..

I don't see why. You initialized an array with three copies of the SAME empty
array.

-s