From: Martin DeMello Date: 2006-08-11T04:46:09+09:00 Subject: Re: Array Building idiom On 8/11/06, John-Mason P. Shackelford wrote: > What other idioms do you use for: > > a=[]; 10.times{a< Array.new(10).map{ callme() } > > Note: callme() returns a new value with each call. > > Do I understand correctly that the former will be illegal under 1.9.1? Illegal on what basis? Also, Array.new takes a block while constructing the array, so you needn't use map: irb> Array.new(10, rand(100)) => [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] irb> Array.new(10) { rand(100) } => [74, 59, 97, 59, 65, 12, 64, 16, 2, 59] martin