Whatever message this page gives is out now! Go check it out!
| Tags | Purpose |
cfif , cfelseif , cfelse | Select sections of code based on whether expressions are True or False. |
cfswitch , cfcase , cfdefaultcase | Select among sections of code based on the value of an expression. Case processing is not limited to True and False conditions. |
cfloop , cfbreak | Loop through code based on any of the following values: entries in a list, keys in a structure or external object, entries in a query column, an index, or the value of a conditional expression. |
cfabort , cfexit | End processing of a ColdFusion page or custom tag. |
<cfoutput>#DateFormat(Now())#</cfoutput>
<cfelseif type IS "Time">
<cfoutput>#TimeFormat(Now())#</cfoutput>
<cfelse>
<cfoutput>#TimeFormat(Now())#, #DateFormat(Now())#</cfoutput>
</cfif><cfswitch expression = #Department#>
<cfcase value = "Sales">
#FirstName# #LastName# is in <b>Sales</b><br><br>
</cfcase>
<cfcase value = "Accounting">
#FirstName# #LastName# is in <b>Accounting</b><br><br>
</cfcase>
<cfcase value = "Administration">
#FirstName# #LastName# is in <b>Administration</b><br><br>
</cfcase>
<cfdefaultcase>#FirstName# #LastName# is not in Sales,
Accounting, or Administration.<br>
</cfdefaultcase>
</cfswitch>
</cfoutput>| Loop type | Description |
Index | Loops through the body of the tag and increments a counter variable by a specified amount after each loop until the counter reaches a specified value. |
Conditional | Checks a condition and runs the body of the tag if the condition is True. |
Query | Loops through the body of the tag once for each row in a query. |
List, file, or array | Loops through the body of the tag once for each entry in a list, each line in a file, or each item in an array. |
Collection | Loops through the body of the tag once for each key in a ColdFusion structure or item in a COM/DCOM object. |
The loop index is <cfoutput>#LoopCount#</cfoutput>.<br>
</cfloop><cfif fruit IS "kumquat">
<cfoutput>You cannot order kumquats!<br></cfoutput>
<cfbreak>
</cfif>
<cfoutput>You have ordered #quantity# #fruit#.<br></cfoutput>
</cfloop>