Search code examples
coldfusioncffunction

How To Call A Void ColdFusion Function With No Arguments


I'm writing a ColdFusion function that is the following:

<cffunction name="checkStatusCode" output="false" access="private" returnType="void">
    <cfif result.Responseheader.Status_Code eq "400">
        <cfset isBadRequest = true>
    </cfif>
</cffunction>

It is both void and contains no parameters; I understand how I would call it if it had parameters and returned something; I'd simply put the code in a <cfset> tag. I simply want to run the function. What tags do I need to put it in?


Solution

  • Either this:

    <cfset checkStatusCode()>
    

    or, if you are using cfscript,

    checkStatusCode();
    

    You could probably use <cfinvoke> if you tried hard enough.