Language Guide

CHAPTER 8
Handlers
Subroutine Denitions and Calls 229
Subroutines With Labeled Parameters 8
This section describes the syntax for defining and calling subroutines with
labeled parameters. Examples of subroutines that use this syntax begin
on page 232.
Subroutine Definition, Labeled Parameters 8
The definition for a subroutine with labeled parameters lists the labels to use
when calling the subroutine and the statements to be executed when it is called.
SYNTAX
( on | to ) subroutineName ¬
[ [ of | in ] directParameterVariable ] ¬
[ subroutineParamLabel paramVariable ]... ¬
[ given label:paramVariable [, label:paramVariable ]...]
[ global variable [, variable ]...]
[ local variable [, variable ]...]
[ statement ]...
end [ subroutineName ]
where
subroutineName (an identifier) is the subroutine name.
directParameterVariable (an identifier) is a parameter variable (also called a
formal parameter) that represents the actual value of the direct parameter. You
use this identifier to refer to the direct parameter in the body of the subroutine
definition. As with application commands, the direct parameter must be first.
Note
If a subroutine includes a direct parameter, the subroutine
must also include either the subroutineParamLabel
parameter or the given label:paramVariable parameter.