<cfset variables.list = "0,1,2,3,4,5,6,7">
<cfloop from="1" to="3" index="i">
<cfoutput>#listgetat(variables.list,i)#</cfoutput><br>
</cfloop>
-----Original Message-----
From: Paul Sinclair [mailto:[EMAIL PROTECTED]]
Sent: 05 February 2002 15:16
To: CF-Talk
Subject: Easy way to loop over first x items of long list
If I have a list of 10 items or so (0,1,2,3,4,5,6,7,8,9) and want to
loop over just the first 3 items (for example), what's the easiest way?
I can't find a List function that selects just the first x items of a
list. I can use ListGetAt to select the 1st one, then the 2nd, then the
3rd, but if I wanted to loop through a large number of items in a long
list, that gets tedious.
I guess there is probably some List function that does this that I have
just overlooked?
Thanks,
Paul
______________________________________________________________________
Dedicated Windows 2000 Server
PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
Instant Activation � $99/Month � Free Setup
http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists