From: Robert Klemme Date: 2010-02-01T23:43:43+09:00 Subject: Re: Creating Arrays Through a Loop 2010/2/1 Squawk Boxed : > 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 Well, it *does* work - only you loose references to a newly created Array immediately. You can try some of these variants: arrs = [] 10.times { arrs << Array.new } arrs = Array.new(10) { Array.new } arrs = (1..10).map { Array.new } Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/