Understanding functions
This is an introduction to functions.
Functions are named program blocks containing a set of statements to be executed when the
function is invoked with a CALL
statement, or when the function is used
in an expression, or when the function is registered in a callback mechanism like
WHENEVER ERROR CALL
.
A functions is defined in a program module, and is by default visible to all modules (a function is global by default), but it can also be declared as private to the module where it is defined.
To write generic code, it is possible to hold a function reference in a program variable. The variable can then be assign with any function reference that is declared with the same function signature as the type used to define the variable.