From: Sebastian Hungerecker Date: 2009-12-28T20:37:16+09:00 Subject: Re: creating array On 28.12.2009 12:25, Haris Bogdanovi� wrote: > Is there a short way of creating array of numbers > with, for example, step of 10, like this: > > 10,20,30,40,50 > > By short I mean without going through iteration loop: > > array=[] > (1..5).each do|i| > array.push i*10 > end > (1..5).map do |i| i*10 end This still has an explicit loop (or at least as explicit a loop as yours does), but is somewhat more concise. On 1.8.7+ you can also do 10.step(50,10).to_a. HTH, Sebastian