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


Fork me on GitHub