From: Rick DeNatale Date: 2008-08-18T07:22:01+09:00 Subject: Re: Creating an array with incrementing values up to a certain number ------=_Part_16523_33035257.1219011915635 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Sun, Aug 17, 2008 at 6:07 PM, 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. > > p (1..100).to_a -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/ ------=_Part_16523_33035257.1219011915635--