Defines a function that you can call in CFML. Required to
defined CFML component methods.
<cffunction name="">
public boolean function myFunction(required any myArgument) { }
anyanyarraybinarybooleandateguidnumericquerystringstructUUIDvariablenamevoidxml(component name)publicprivatepackagepublicremotetruefalseJSONplainWDDXtruefalsetruefalsecfhttp type="URL" tag.getpostputdeleteheadoptionsclassicfalse).true).
classicmodernabstract (implementation must be defined in extended component), static (does not access instance variables in the component) or final (implementation cannot be extended)
abstractfinalstaticabstract and final functions in Lucee5+static functions in Lucee5+public boolean function myFunction(required any myArgument) {
// Some function bits
return true;
}
<cffunction access="public" returntype="boolean" name="myFunction">
<cfargument required="true" type="any" name="myArgument">
<!--- Some function bits --->
<cfreturn true>
</cffunction>
Note that as of now, you cannot declare the access or returntype of an arrow function
myFunction = (required any Arguments) => {
return true;
}
Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.