Home > Articles

Introduction to Using Arrays in ColdFusion MX

  • Print
  • + Share This
This chapter from ColdFusion MX Developer's Cookbook shows you how to iterate over array element values, manipulate element values, and sort an array. It also explains how and when to use multidimensional arrays and how and when to use array aggregate functions.
This chapter is from the book

This chapter is from the book

3.0. Introduction

An array is a data type containing an ordered collection of variables. Items in an array are referred to as array elements and are referenced by their index (or numerical position) in the array.

You use arrays when you have a collection of variables and need to store them in a defined order. Like lists (discussed in Chapter 2, "Working with Lists"), arrays support variable order—you can explicitly reference the value stored in a given position of the array. Although lists only store simple variables like strings and numbers, arrays can store complex data types, such as structures, queries, and even other arrays. If you need to store complex data types in a collection but do not need them in a defined order, you may want to look into using the ColdFusion data type structure, discussed in Chapter 4, "Structures."

This chapter shows you how to iterate over array element values, manipulate element values, and sort an array. It also explains how and when to use multidimensional arrays and how and when to use array aggregate functions.

  • + Share This
  • 🔖 Save To Your Account