How to use cfbreak to break a loop in ColdFusion

cfbreak - break a loop

cfbreak.cfm



<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfbreak tag example: how to use cfbreak tag to break a loop</title>
</head>

<body>
<h2 style="color:Crimson">cfbreak Tag Example</h2>

<cfloop from="1" to="10" index="Counter" >
 <cfoutput>
  <b>Current Counter:</b> #Counter#
        <br />
        <cfif Counter EQ 6>
         loop break at the position 6
            <cfbreak>
        </cfif>
 </cfoutput>
</cfloop>

<br /><br />
Other code goes here...

</body>
</html>







More ColdFusion examples