<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;
}
See also
- Components (CFCs)
- <cfcomponent>
- <cffunction>
- Search Issue Tracker
- Search Lucee Test Cases (good for further, detailed examples)