Haris Bogdanovi´┐? wrote:
> Hi.
> 
> 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
> 
> 
> Thanks
> Haris

Take a look at Array.new[1]:

irb(main):001:0> Array.new(5){|i| i * 10}
=> [0, 10, 20, 30, 40]

With a little bit of math you should be able to get your desired result.

Marvin

[1]: http://www.ruby-doc.org/ruby-1.9/classes/Array.html#M000684
-- 
Posted via http://www.ruby-forum.com/.