# User-Defined Functions > [HTML Version](user-definedfunctions.htm) _Updated October 2016; see History_ **\{PRIVATE\} \{DYNAMIC\} FUNCTION FN'name\{\$\}(p1\{=defval\} \{as typsiz\{:mod\}\},...pN...) \{as typsiz\}** ** FN'name = ** \! set return value ** ** **ENDFUNCTION** The function definition, as shown above, starts with the zero or one of the optional keywords "PRIVATE" / "DYNAMIC" (see [Private Functions and Procedures](privatefunctionsandproc.htm.md) and [Dynamic Functions](dynamicfunctions.htm.md) for details), followed by the keyword "FUNCTION" followed by the function name, the list of formal parameters, and the function return type. The function name by convention starts with **FN'**, **Fn'**, or **fn'** so that references embedded in expressions can easily be identified as function calls rather than arrays; see [Function Name and Type](functionnameandtype.htm.md) for clarification. The function name must end with **\$** if the function returns a string or unformatted or defined structure type. If the final \{_as typsiz_\} clause (which defines the return type of the function) is omitted, the default type is **F6**. The _typsiz_ (data type and size) specification is similar to that used in MAP statements, except without a comma between the type code and the size. For example: FUNCTION Fn'Test(p1 as S10, p2 as f6, p3 as B2, p4 As x256) AS i2 Function fn'display'name\$(cus as ST\_CUS\_REC, bold as BOOLEAN) as s MAX\_NAME function fn'test(p1 as s20:inputonly, p2 as ST\_PHONE:outputonly) The first example above illustrates that, as with virtually all keywords, the FUNCTION keyword and_ AS typsiz _clauses are **not** case sensitive. However, as with all other variables and labels, the function name and the formal parameter names **are** case sensitive, unless compiled with the /ci option. The optional \{=_defval_\} clause assigns a default value to the parameter; see Named Parameters. The optional :_mod_ clause may be used to declare certain modifying attributes for the parameter, such as _inputonly _or _outputonly_; see Parameter Type and Size. **See Also** • [XFUNC()](xfunc().htm.md) • [Procedures](procedures.htm.md) • [SOSLIB:\[907,10\]](https://bitbucket.org/microsabio/soslib/src/master/907010/?at=default) also known as SOSFUNC **History** 2016 August, A-Shell 6.3.1523, compiler edit 770: Add private attribute for functions and procedures. 2014 October, A-Shell 6.1.1391: Function name does not need to begin with FN'; see History note in [Function Name and Type](functionnameandtype.htm.md) 2014 September, A-Shell 6.1.1389: A-Shell now supports [Passing DIMX Arrays](passingdimxarrays.htm.md) to functions/procedures by reference. 2014 January, A-Shell 6.1.1373: [Named parameters](errortrappinginfunctions.htm.md) implemented in A-Shell. **Subtopics** - [Function Name and Type](functionnameandtype.htm.md) - [Parameter Type and Size](parametertypeandsize.htm.md) - [Named Parameters](namedparameters.htm.md) - [Parameter Passing](parameter-passing.htm.md) - [Return Expression](returnexpression.htm.md) - [Local Variables](localvariables.htm.md) - [Global/External Variables](globalexternalvariables.htm.md) - [Exit Label \$EXIT](exit_label_$exit.htm.md) - [Error Trapping in Functions](errortrappinginfunctions.htm.md) - [Invoking A Function](invokingafunction.htm.md) - [Private Functions and Procedures](privatefunctionsandproc.htm.md) - [Dynamic Functions](dynamicfunctions.htm.md) - [Ellipsis Function Arguments](ellipsisfunctionarguments.htm.md) - [Indirect Function Calls](indirectfunctioncalls.htm.md) - [User-Defined Function Examples](user-definedfunctionexamples.htm.md) - [Implicit Function Return Value Capture](implicitfunctionreturn.htm.md)