<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>

Attribute Description Default
default
any, optional

default value of the argument

required
boolean, optional

is argument required or not

passby
string, optional

should the argument passed as reference (default) or as a value

reference

hint
string, optional

hint to the argument (only used by components)

displayname
string, optional

name to display (only used by components)

name
string, required

The name of the argument

type
string, optional

the type of the argumentany (array, binary, boolean, date, guid, numeric, query, string, struct, uuid)

<cfargument
    [default=any]
    [required=boolean]
    [passby=reference|value]
    [hint=string]
    [displayname=string]
    name=string
    [type=string]
>

Examples

```lucee+trycf <cfreturn arg1 + arg2 />

<cfscript>
    writeDump("Define function using cfscript. It returns: "&add(2,3));
    public function add(required numeric arg1,required numeric arg2){
       return arg1+arg2;
    }
</cfscript>

```

See also