User Guide

48 Chapter 2: ColdFusion Tags
<!--- reset the variable and show the use of cfabort --->
<cfset myVariable = 3>
<!--- now, perform a loop that increments this value --->
<cfloop from = "1" to = "4" index = "Counter">
<!--- on the second time through the loop, cfabort --->
<cfif Counter is 2>
<cfabort>
<!--- processing is stopped, and subsequent operations are not carried out
--->
<cfelse>
<cfset myVariable = myVariable + 1>
</cfif>
</cfloop>
<cfoutput>
<p>The value of myVariable after incrementing through the loop
#counter# times is: #myVariable#
</cfoutput>