Variables are the c:Ce of any programming environment. Without variables it is impossible to abstractly refer to values by name and it is impossible to develop logical processes that achieve specific goals.
Without variables the value of programming of any sort whether it is ColdFusion style Web scripting or full-scale development of operating systems, is greatly diluted.
In this chapter you will take a broad look at the variables used in ColdFusion. You. will start by considering the of data that can be processed in ColdFusion and then move on to an overview of the types of variables available-including user-created variabIes and system-created variables such as CGI URL and cookie variables
In addition you will look at two useful tags for creating variables: CFSET and CFPARAM
Understanding Data Types
Variables act as containers for holding data that can then be referred to by name. This allows the development of prograplS that act in different ways based on the content of those variables and allows the creation of highly readable program code because instead of raw values the program uses names that clarify the purpose of the data being manipulated
To make vartable’s useful it is necessary to perform actions on the data in the variables. These actions can be everything from comparing two variables to adding two variables to concatenating two variables
To understand these operations which you will encounter throughout the book you need to understand the various types of data that variables can contain.
In ColdFusion the following basic data types exist
• Boolean values
• Date/time values
• Binary objects
In addition several more sophisticated types are available:
• Component Object Model (COM) objects
These more complex data types are considered elsewhere in the book. Specifically lists structures and arrays are discussed in Chapter 14, “Working with ColdFusion Data Structures” and COM objects are explained in Chapter 32, “Including External Objects.” Queries are discussed throughout the book, including in Chapter 3 “Getting Data from a Database,” Chapter 10, “Using SQL to Interact with the Database,” and Chapter 11, “Building Dynamic Using Advanced Query Techniques.”
The basic data types are outlined in more detail in Chapter 6 “Writirg Expressions.” Most of this chapter can be read without a detailed understanding of d rta types. However if you want to learn more about data types before proceeding with this chapter review the relevant sections in Chapter 6.