From: Marnen Laibow-Koser Date: 2010-02-01T23:43:43+09:00 Subject: Re: Creating Arrays Through a Loop Squawk Boxed wrote: > I was wondering if it was possible to create a series of arrays through > a loop. This doesn't work (I think): > > for num in 1..10 > array_num = Array.new > end Of course that doesn't work. You're setting the same variable (array_num) each time. What you should do is use an array of arrays: array_of_arrays = Array.new(10) {Array.new} Best, -- Marnen Laibow-Koser http://www.marnen.org marnen@marnen.org -- Posted via http://www.ruby-forum.com/.