cfbreak

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

  <cfbreak>

 break;

Examples
Sample code using the cfbreak tag

Example Using Script Syntax

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

Expected Result: 1 2 3 4 5

Shows tag based syntax.

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

Expected Result: 1 2 3 4 5

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

Fork me on GitHub