- 2.2.12.1 -
TMT Pascal Language Description
Pascal Language Structure
Procedures and FunctionsProcedures and Functions Declaration
Procedures and functions take the following form:
procedure identifier [(Parameterlist)]}
or
function identifier [(Parameterlist)] : ReturnType}
ReturnType is the type of the value returned by the function.
Parameterlist is defined as:
Parameter [;Parameter]}
where Parameter is:
[var] identifier [,identifier] [: TypeName]}
or
[const] identifier [,identifier] [: TypeName]}
var specifies a variable parameter. const specifies a constant
parameters. var and const parameters are passed by reference
as opposed to being passed var and const parameters are passed
by reference as opposed to being passed by value.
The body of a procedure or function takes the following form:
[Declarations]
begin
statement [; statement]
end;
Types, labels, constants, and variables declared in the declaration section
prior to the begin statement are local variables. Space for these
variables is allocated only when the procedure is called. Like all variable
declarations their data is undefined until initialized. TMT Pascal procedures
and functions may be called recursively.
All identifiers must be declared prior to being referenced. The same rule
applies to procedures and functions.
|
|
|
Procedures and Functions |
Table of Content |
Forward Declaration |
- 2.2.12.1 -