From: "David A. Black" Date: 2007-08-18T20:37:00+09:00 Subject: Re: How do you print the first 5 records in an array? Hi -- On Sat, 18 Aug 2007, Dirk Bruijn wrote: > Sebastian Hungerecker wrote: >> Dirk Bruijn wrote: >> >>> Stefano Crocco wrote: >>> >> >> >>>> puts @people [0..4] >>>> >>> 0.upto(4) { |x| puts @people[x]} >>> >> >> Why do you feel that that's preferable to Stefano's solution? >> >> >> > It's not. I mistakenly placed my reaction on the wrong leaf. I'd avoid iterating through a whole array just to puts its elements, but in this case your code avoids creating a temporary sub-array. So there might be some reason to use that technique. David -- * Books: RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com)