From: Robert Klemme Date: 2004-09-21T16:24:40+09:00 Subject: Re: Filling a 2D array "Mehr, Assaph (Assaph)" schrieb im Newsbeitrag news:338366A6D2E2CA4C9DAEAE652E12A1DE01F5B3B5@au3010avexu1.global.avaya.com... > > > @tileArray = Array.new() > > @height.times {@tileArray.push Array.new(@width, Tile.new)} > > @height.times {@tileArray.push Array.new{@width, Tile.new}} > ^ ^ The correct syntax is Array.new(@width) {Tile.new} > As always, when you need to initialize an array with new objects per > cell (rather than references to the same object) use the block form. > You had initialized the first array correctly, but must have mistyped > for the inner array creation :-) Right. robert