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 (known as the “caller”). The procedure returns a value to the caller.

Each time some code calls a procedure, its statements run, which starts with the first control statement after Function. Control usually continues until the line End. But, it can be stopped by one of the statements Exit Function or Return.

You can make a function procedure in modules, classes, objects, and traits. Function procedures are private. They can be called only by other code in the same container (class, object, or trait), or module if not in one of these containers.

A function procedure can have arguments, for example, constants, variables, or expressions, passed to it by the caller.

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


To return a value


Calling syntax


Example of declaration and call


See also