Understanding ColdFusion Lists

Until now, you've dealt only with variables that hold a single value, be it a word, a text string, or a number. ColdFusion lists are variables that can hold more than one value, by storing values in a comma-delimited list, such as:

names="Bobby,Peter,Greg,Cindy,Marsha,Jan"

Instead of using five separate variables like

name1="Bobby"
name2="Peter"

and so on, I can assemble individual values into a list and then get at the contents later either by looping through values one by one, or by referring to the specific offset of one list item or another.

A variable's offset value is the order number in which it appears in a list. In a list like Bobby,Peter,Greg,Cindy,Marsha,Jan, the name "Bobby" has an offset value of ...

Get Sams Teach Yourself ColdFusion® in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.