[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
Programs Pascal Program Structure
A Standard Pascal program has the following structure:
program <name>(<parameters>);
<label section>
<const section>
<type section>
<var section>
<subprograms>
begin
<main body>
end.
where the following definitions hold:
<name> Any legal identifier.
<parameters> External files associated with the program. These
identifiers should be declared as file variables in
the global variable section.
<label section> The keyboard LABEL followed by a list of labels (1-
to 4-digit numbers, separated by commas and ending
with a semicolon).
<const section> The keyword CONST followed by one or more constant
declarations.
<type section> The keyword TYPE followed by one more more data type
declarations.
<var section> The keyword VAR followed by one or more variable
declarations.
<subprograms> Any number of procedures or functions.
<main body> Any number of statements, separated by semicolons.
In Standard Pascal, each of the sections above--label, const, type,
var, and subprogram--can appear only once and must appear in the order
given. If no such declarations are needed--for example, if you have no
labels--then you can simply omit that section.
Turbo Pascal is more flexible in its definition of program structure.
First, the <parameters> section is neither required nor recognized; if
put there, it is ignored. Second, you can freely rearrange the order
of the label, const, type, var, and subprogram sections, and you can
have multiple instances of each.
See Also:
labels
constants
types
variables
subprograms
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson