TAL Reference Manual

Procedures
TAL Reference Manual526371-001
13-15
Subprocedure Declaration
2. This example shows a FORWARD declaration for PROCB, a procedure that calls
PROCB before its body is declared, and a declaration for the body of PROCB:
INT g2;
PROC procb (param1); !FORWARD declaration
INT param1; ! for PROCB
FORWARD;
PROC proca;
BEGIN
INT i1 := 2;
CALL procb (i1); !Call PROCB
END;
PROC procb (param1); !Body for PROCB
INT param1;
BEGIN
g2 := g2 + param1;
END;
Subprocedure Declaration
You can declare subprocedures within procedures, but not within subprocedures.
type
specifies that the subprocedure is a function that returns a result and indicates the
data type of the returned result.
type can be any data type described in Section 3,
Data Representation.
identifier
is the identifier of the subprocedure.
VST1310.vsd
identifierSUBPROC
type
;
parameter-list VARIABLE
param-spec
;
subproc-body
FORWARD
;