From: Aldric Giacomoni Date: 2010-02-01T23:44:31+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 It works fine, but it will always assign the new array to the same variable. One idea is to create an array, and then add arrays as elements. main_array = Array.new (1..10).times { main_array << Array.new } This may do what you want, but there may also be a more Ruby-ish way, depending on why you need those arrays. -- Posted via http://www.ruby-forum.com/.