You create most ColdFusion variables by assigning them values. (You must use the
ArrayNew function to create arrays.) Most commonly, you create variables by using the
cfset tag. You can also use the
cfparam tag, and assignment statements in CFScript. Tags that create data objects also create variables. For example, the
cfquery tag creates a query object variable. ColdFusion automatically creates some variables that provide information about the results of certain tags or operations. ColdFusion also automatically generates variables in certain scopes, such as Client and Server. For information on these special variables, see
Reserved Words and Variables in the
CFML Reference and the documentation of the CFML tags that create these variables. ColdFusion generates an error when it tries to use a variable before it is created. This can happen, for example, when processing data from an incompletely filled form. To prevent such errors, test for the variable's existence before you use it. For more information on testing for variable existence, see
Ensuring variable existence. For more information on how to create variables, see
Creating and using variables in scopes in the
About scopes.