In addition to the built-in functions, you may create your own. A function is a code module—a set of statements—to which a name is assigned. The statements can be called by the function name as often as needed. Functions also provide a mechanism whereby the function can take one or more parameters that are acted upon by the function.

A function is called by following the function name with a set of parentheses, which act as the call operator. When discussing a function, the parentheses are included to help distinguish functions from other language elements like variables.

For example, the function LDoM( ) takes a date parameter dArg and returns the last day of the month of that date.

function LDoM( dArg )

local dNextMonth 

dNextMonth = dArg - date( dArg ) + 45 // Day in the middle of next month 

return dNextMonth - day( dNextMonth ) 

Functions are identified by the keyword FUNCTION in a program file; they cannot be typed into the Command window. While many functions use RETURN to return a value, they are not required to do so.