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

Two more ways of doing it:

Array.new(4) { |i| i + 1 } + [0]
(1 .. 4).to_a + [0]

Too bad [*1..4, 0] doesn't work.

-- 
http://flgr.0x42.net/