Sub
Procedures
A subroutine procedure is a sequence of ViviFire statements between the lines Sub
and End
.
The procedure does a task, then returns control to the code that called it, also known as the “caller”.
The procedure can return a value to the caller.
Each time the procedure is called, its statements run.
It starts with the initial statement after Sub
and usually continues until End
(or End Sub
).
But one of two statements can stop it: Exit Sub
or Return
.
You can use Sub
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 subroutine procedure can have arguments (constants, variables, or expressions) which the caller passes to it.
Declaration syntax
Sub sub_name [ parameter_list ]
' statements
End Sub
Parameter declaration
Parameters as local variables
TODO
Calling syntax
TODO
Example of declaration and call
TODO