<cfargument>
Defines a parameter that may be sent when the function is called.
When used, cfargument tag(s) must be the first tags used within the cffunction.
This tag cannot have a body.
This tag is also supported within <cfscript>
<cfargument
name=string
type=string
required=boolean
default=any
displayName=string
hint=string
passBy=reference|value
>
Examples
<cfoutput>
<cffunction access="private" name="add">
<cfargument name="arg1" type="Numeric" required />
<cfargument name="arg2" type="Numeric" required />
<cfreturn arg1 + arg2 />
</cffunction>
<cfdump var="Define function Using tag.It returns :#add(4,2)#" />
</cfoutput>
writeDump("Define function using cfscript. It returns: "&add(2,3));
public function add(required numeric arg1,required numeric arg2){
return arg1+arg2;
}
Related System Properties / Environment Variables
- LUCEE_SUPPRESS_WS_BEFORE_ARG - A boolean value. If enabled, Lucee suppresses whitespace defined between the cffunction starting tag and the last cfargument tag. This setting is ignored when there is different output between these tags as whitespace
Type: boolean, Default: true
See also
- Components (CFCs)
- <cfcomponent>
- <cffunction>
- Search Issue Tracker
- Search Lucee Test Cases (good for further, detailed examples)