Skip to content

Instantly share code, notes, and snippets.

@bennadel
Created March 13, 2023 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bennadel/3743bed5c1b66950d184bc2c8ff2e563 to your computer and use it in GitHub Desktop.
Save bennadel/3743bed5c1b66950d184bc2c8ff2e563 to your computer and use it in GitHub Desktop.
Using "return" To Short-Circuit A CFML Template In ColdFusion
<cfscript>
writeOutput( "A-1 <br />" );
return;
writeOutput( "A-2 <br />" );
</cfscript>
<cfscript>
writeOutput( "B-1 <br />" );
return;
writeOutput( "B-2 <br />" );
</cfscript>
<cfscript>
writeOutput( server.coldfusion.productName & " - " );
writeOutput( server.coldfusion.productVersion & "<br />" );
include "a.cfm";
include "b.cfm";
writeOutput( "Done <br />" );
</cfscript>
<cfscript>
(() => {
writeOutput( "UDF Context <br />" );
writeOutput( server.coldfusion.productName & " - " );
writeOutput( server.coldfusion.productVersion & "<br />" );
include "a.cfm";
include "b.cfm";
writeOutput( "Done <br />" );
})();
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment