Whatever message this page gives is out now! Go check it out!

cfbreak

Last update:
May 18, 2026

Description

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

Category

Syntax

<cfbreak>

See also

cfabortcfcontinuecfexecutecfifcflocationcfloopcfthrowcftrycfloop and cfbreak in the Developing ColdFusion Applications

Tag example

 
<cfloop index="i" from="1" to="10">
    <cfoutput>#i#</cfoutput>
    <cfif i GE 5>
        <cfbreak>
    </cfif>
</cfloop>
Script example
 
<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

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page