From: Kirk Lowery Date: 2001-06-19T02:09:36+09:00 Subject: [ruby-talk:16592] Re: Two (or more) dimensional arrays? On 18 Jun 2001, at 15:06, Niklas Frykholm wrote: > On Mon, Jun 18, 2001 at 11:03:26AM +0900, Kirk Lowery wrote: > > After reading my way through various documentation, I didn't find any > > explanation of how to create arrays of more than one dimension. Is that > > because ruby has a different idiom for it? > > A ruby Array can hold any kind of object. To make a multidimensional > array, create an array that holds Array objects. > > irb(main):001:0> a = [[1,2,3],[4,5,6]] > [[1, 2, 3], [4, 5, 6]] > irb(main):002:0> a[0][2] > 3 > > // Niklas Of course! That is what is so attractive about Ruby. Simple and elegant. It's going to take this old Perl Hacker Wannabe a while to adjust, but it's things like this which really encourages me to learn and use Ruby. Thanks! Kirk -- Kirk Lowery Kirk@leningradensis.org