Tutorial by Examples

You can set a ColdFusion variable using the <cfset> tag. To output the variable, you need to surround the variable name with hash # symbols and enclose it within <cfoutput> tags. <cfset variablename="World!"> <cfoutput> Hello #variablename# </cfoutput>...
The <cfparam> tag creates a variable if it does not already exist. You can assign a default value using the default attribute. This can be used if you want to create a variable, but don't want to overwrite it if it has been previously created elsewhere. Here the variable hasn't been set previ...
You can check if a variable has been defined in a scope by using ColdFusion's built in StructKeyExists() function. This can be used inside a <cfif> tag to prevent error messages in the event you attempt to refer to a variable that does not exist. You can also use this function to determine whe...
It is a common practice to set application variables to an object scope. This keeps them easy to identify and distinguish from variables in other scopes. The Variables scope in a CFC is private to the CFC. When you set variables in this scope, they cannot be seen by pages that invoke the CFC. <...

Page 1 of 1