| Calling procedures and functions
When you call a procedure or
function, program control passes from the point where the call is
made to the body of the routine. You can make the call using the
routine's declared name (with or without qualifiers) or using a
procedural variable that points to the routine. In either case, if
the routine is declared with parameters, your call to it must pass
parameters that correspond in order and type to the routine's
parameter list. The parameters you pass to a routine are called
actual parameters, while the parameters in the routine's
declaration are called formal parameters.
When calling a routine, remember
that
- expressions used to pass typed
const and value parameters must be assignment-compatible with the
corresponding formal parameters.
- expressions used to pass var and
out parameters must be identically typed with the corresponding
formal parameters, unless the formal parameters are
untyped.
- only assignable expressions can be
used to pass var and out parameters.
- if a routine's formal parameters
are untyped, numerals and true constants with numeric values cannot
be used as actual parameters.
When you call a routine that uses
default parameter values, all actual parameters following the first
accepted default must also use the default values; calls of the
form SomeFunction(,,X) are not legal.
You can omit parentheses when passing all and only the default
parameters to a routine. For example, given the
procedure
procedure DoSomething(X: Real
= 1.0; I: Integer = 0; S: string = '');
the following calls are
equivalent.
DoSomething();
DoSomething;
|