cfexit

This tag aborts processing of the currently executing CFML
custom tag, exits the page within the currently executing CFML
custom tag, or re-executes a section of code within the
currently executing CFML custom tag.

  <cfexit>

 exit;

Attribute Reference

method string

exittag: aborts processing of currently executing tag
exittemplate: exits page of currently executing tag
loop: reexecutes body of currently executing tag
Values:
  • exittag
  • exittemplate
  • loop

Examples
Sample code using the cfexit tag

Here the loop over the 5 number. When it's meet the condition as true then the block of code get exit.

<cfoutput>
<cfloop from="1" to="5" index = "i">
<cfif i EQ 3>
	<cfexit>
<cfelse>
	#i#
</cfif>
</cfloop>
</cfoutput>

Expected Result: 1 2

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub