Contact Us

Let us know to help you out quickly!

 Bharat Patel     Feb,08 2017

How to Declare Argument's Attributes in cfscript Function

All persons are familiar with cfscript function would like to know how to define parameters qualifiers in cfscript function.
It is just FYI on how to define arguments qualifiers i.e. default value of parameter, It's datatype, Required Or Not. I hope you may find it interesting.

Syntax

public function fun_name(required string argument1 = ''){}

Generally, Using <cfargument /> tag we may declare something like this.

<cfargument name="arg1" default="123" required="true" type="numeric">


CfScript Equivalent:
public function scriptFunction(required numeric arg1 = 123){.....}

You need to take care about sequence of argument. It will take default required = 'false'. Click here to know more...