• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 6. Using ColdFusion Lists, Array... > Using ColdFusion Structures

Using ColdFusion Structures

The final ColdFusion mechanism for storing multiple values is the structure. Structures are complex data types just as arrays are, but structures differ from arrays in that they do not use sequential numerical indexes to indicate where information can be found. Instead, structures use keys to look up data elements stored inside them. This provides the advantage of having a related key assigned to each value, rather than a seemingly arbitrary number. For example, in the aGrades array from the previous section, no clear relationship exists between any of the array indexes and the grade stored at that index. With structures, you could make each key a student's name and the value associated with the key would be that student's grade. This is a principal advantage of structures: They allow for meaningful relationships to exist between the keys and values.

The following sections examine the basics of how to work with ColdFusion structures. As with lists and arrays, the easiest way to manipulate structures is by means of CFML functions.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint