Function                                                                                                Statement

 

FUNCTION functionName(varList) AS resType

 

Description

Defines the start of a function, the variables that are passed as arguments and the type of result returned. A function always returns a result to the calling program. Each variable in varList is defined as Varname AS varType where varType is the type of variable(Integer, Float, etc). Variables are separated by commas. This can be any of the valid data types(Integer, Float, array, UDT etc.), except for the database type.

 

A FUNCTION statement defines the start of a function and the end of the function is defined by the END FUNCTION statement. A function's return value is set somewhere in the function's executable statements by assigning the function's name to a value or computation. Array and UDT datatypes may not be returned.

 

When END FUNCTION is executed, the function returns control to the calling program. Parenthesis ("()") are required if there are no arguments.

 

Example

Function Calc1(rate as Float, loanAmt as Float) as Float

  Calc1=rate * loanAmt 'this value is returned

End Function