Variables in CFML

Variables are the workhorses of any language. They allow for manipulation of values, storage of data and give languages the ability to maintain and control state during processing. To work with any language one of the first things you must learn is how to set and manipulate variables in it.

ColdFusion offers many different kinds (or scopes) and types of variables. Each kind of variable is useful in its own way and each has pros and cons to consider before using it. Except where noted the following information should be considered applicable to ColdFusion versions 4 or greater. Much of the information is applicable to version 3 and even less to version 2 but to simplify things we're only covering more recent versions.

As always we're going to try and explain our topic in a clear, understandable way. If you notice an error or would like something further detailed please let us know. The following sections are designed to be read in order. More advanced readers may want to skip the first three or four sections however as they cover very basic concepts.

Special Thanks

Many people assisted with the creation of this guide. Isaac Dealy, creator of Tapestry was, as always, a great sounding board. Dave Watts of Figleaf and Adam Cameron went above and beyond in reviewing the material and ended up teaching me a few new things in the process. Matthew Woodward, Sean A Corfield, Andy J, Erik Allen, Brian Simmons, and Matt Robertson provided invaluable comments and proofreading.

173 Current Sessions; Time: 22:10:04 06-01-2009; Tick: 531