From: Ludo Date: 2002-12-11T02:54:15+09:00 Subject: Re: 8x8 matrix sorry, I want write: matrix = (0..7).map { (0..7).map {0} } nb: the init element isn't an array! On Tue, 10 Dec 2002 18:43:00 +0100, Ludo wrote: > about using map (from The Ruby Way), > you can do: > > matrix = (0..7).map { (0..7).map {[0]} } > > On Wed, 11 Dec 2002 02:39:01 +0900, Mike Campbell wrote: > >> there was a solution posted a couple days ago using #map. >> >>> -----Original Message----- >>> From: Sebastian Ruhs [mailto:RembrandtAkaDodger@gmx.de] >>> Sent: Tuesday, December 10, 2002 12:14 PM >>> To: ruby-talk ML >>> Subject: 8x8 matrix >>> >>> >>> Is there an easier way to create a 8x8 matrix then: >>> a=Array.new >>> 0.upto(7) {|i| a[i]=Array.new(8,0)} ?