From: "David A. Black" Date: 2008-08-18T07:25:17+09:00 Subject: Re: Creating an array with incrementing values up to a certain number Hi -- On Mon, 18 Aug 2008, Brian Ross wrote: > Hello, > > Another basic question, thanks for the help on the last one. I wanted to > come up with the above described program and came up with this: > > # array.rb start > > a = [1] > x = 0 > while x < 99 > a[(x+1)] = (a[x] + 1) > x = x + 1 > end > p a > > # array.rb end > > This worked fine, but is there a more elegant way of doing this? It seems a > bit clumsy. In addition to the other answers: a = [*1..99] David -- Rails training from David A. Black and Ruby Power and Light: Advancing With Rails August 18-21 Edison, NJ * * Co-taught by D.A. Black and Erik Kastner See http://www.rubypal.com for details and updates!