From: Martin DeMello Date: 2006-02-02T06:53:22+09:00 Subject: Re: [RCR] Numeric#of Phil Duby wrote: > > I was looking for a clean (Ruby) way of creating an array of ascending > integer values, with the final value zero. IE [ 1, 2, 3, 4, 0 ] > i = 0; a = Array.new( 4 ) { i += 1 }.push 0 > does what I want. (1..4).to_a.push(0) also Array.new passes in the index to the block, so you can do Array.new(4) {|i| i+1} martin