Description

Used within a cfloop tag. Breaks out of a loop.

Category

Flow-control tags

Syntax

<cfbreak>

See also

cfabortcfcontinuecfexecutecfifcflocationcfloopcfthrowcftrycfloop and cfbreak in the Developing ColdFusion Applications

Tag example

<cfloop index="i" from="1" to="10">
<cfoutput>#i#</cfoutput><br>
<cfif i Ge 5>
<cfbreak>
</cfif>
</cfloop>

Script example

for (i=1; i <= 10; i++){
writeOutput("#i#<br>");
if (i >= 5){
break;
}
}

Either version of the code above outputs:

1
2
3
4
5

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy