Function Procedures

A function procedure is a sequence of ViviFire statements between the lines Function and End. The function procedure does a task, then returns control to the code that called it, also known as the “caller”. The procedure returns a value to the caller.

Each time the procedure is called, its statements run. It starts with the initial statement after Function and usually continues until End (or End Function). But one of two statements can stop it: Exit Function or Return.

You can use Function in modules, classes, objects, and traits. It has private member access. Thus, it can be called only by other code in the same (1) class, (2) object, (3) trait, or (4) module.

A function procedure can have arguments (constants, variables, or expressions) which the caller passes to it.

Declaration syntax

Function function_name [ parameter_list ]
    ' statements
End Function

You declare the parameter list almost the same as you do for Sub Procedures.

Data type

TODO

To return a value

TODO

Calling syntax

TODO

Example of declaration and call

TODO

See also