From: "David A. Black" Date: 2007-08-18T20:34:02+09:00 Subject: Re: How do you print the first 5 records in an array? Hi -- On Sat, 18 Aug 2007, Stefan Rusterholz wrote: > Bob Sanders wrote: >> Let's say I have an array defined as: >> >> @people = ["Jim", "Jen", "Jess", "Jay", "Jack", "John", "Jeff", "Jed", >> "Jill"] >> >> How would I then print out the first 5 records of that array? (i.e. from >> Jim to Jack) >> >> Any ideas? > > puts(*@people.first(5)) > Ruby, so surprisingly unsurprising :) I don't think you need the * there. 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)