|Top Previous Next|
Declares the name, parameters and code that define a Function procedure.
The parameter list contains one or more variables separated by a comma, the datatype must not be declared. Parameters by reference must be declared by using the BYREF directive.
To return a value from a function, you have to assign the value to the function name. You can also use the return statement with a result value to exit the function, eg. "return i"
Use a FUNCTION statement when you need to return a value to the calling code. Use a SUB statement when you do not need to return a value.