# External (XFUNC) Functions
> [HTML Version](externalxfuncfunctions.htm)
XFUNC() and XFUNC\$() provide a means of calling external subroutines as if they were functions.
**XFUNC(Sbxnam, Arg1, Arg2,..., Argn)**
**XFUNC\$(Sbxnam, Arg1, Arg2,..., Argn)**
[XFUNC](xfunc().htm.md) (without the \$) is a numeric function (i.e. evaluates to a floating point value), while XFUNC\$ is for string functions. _Sbxnam_ is a string expression that evaluates to the name of the SBX module containing the function code. _Arg1_ through _Argn_ are arbitrary arguments or parameters to the function, analogous to the parameters in a subroutine statement.
From the standpoint of the calling program, XFUNC and XFUNC\$ may be used within expressions just like any other numeric function or string function, for example:
PRINT XFUNC\$("CENTER",Name\$,40);
TOTAL = QTY \* XFUNC(PriceFunc\$,Part\$,Cust\$,QTY)
The SBX implementation of the function must end with a special version of the RETURN statement which specifies the value to return:
RETURN ()
The should be numeric for functions to called by XFUNC(), and string for those called by XFUNC\$(). This form of the RETURN statement will be treated the same as END—i.e. terminate subroutine and return to calling program—if the SBX was called via a subroutine statement.
External functions may also return updated parameter values just like subroutines do. In fact, a single SBX module may act as both an external function and a subroutine. The distinction is just in how it is called (via XCALL, XFUNC or XFUNC\$).
**See Also**
• [XCALL](callingexternalroutines.htm.md)
• [VXCALL](runtimeresolutionofnames.htm.md)
• [AG\_XFUNC](ag_xfunc.htm.md)