Used within a cfloop tag. Breaks out of a loop.
<cfbreak> |
cfabort, cfcontinue, cfexecute, cfif, cflocation, cfloop, cfthrow, cftry; cfloop and cfbreak in the Developing ColdFusion Applications
<cfloop index="i" from="1" to="10">
<cfoutput>#i#</cfoutput>
<cfif i GE 5>
<cfbreak>
</cfif>
</cfloop>
<cfscript>
for (i=1; i <= 10; i++){
writeOutput(i)
if (i >= 5){
break
}
}
</cfscript>
Either version of the code above outputs:
1 2 3 4 5
Sign in to your account