Normally you create a function using cfscript like:
<cfscript>
function foo() { return "bar"; }
</cfscript>
Is there a way to declare this as a private function, available only to other methods inside the same cfc?
I know you can do it with tags:
<cffunction name="foo" access="private">
<cfreturn "bar">
</cffunction>
But I don't want to have to rewrite this large function thats already written in cfscript.
Not in ColdFusion 8. It was added in CF9, though.
You don't need to rewrite the whole function, you can do this:
<cffunction name="foo" returntype="string" output="false" access="private">
<cfscript>
return "bar";
</cfscript>
</cffunction>
If you have access to CF9, the new syntax is:
private string function foo() output="false" {
return "bar";
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With