Professional Documents
Culture Documents
Pascal Procedures
Pascal Procedures
Declaring Procedures
Syntax:
Procedure Procedurename (parameter: data type, parameter: data type);
Begin;
Statements;
End;
Calling Procedures
The procedure should be declared before the Begin of the main program and the
procedure name should be used to call the procedure from within the main program.
Syntax:
Program ProgramName (input, output);
Begin;
Statements;
End;
Begin;
ProcedureName;
End.
Using Procedures from other PAS files
Procedures can be stored in other files so as to avoid a cluttered program. If the program
is to use those procedures the file name needs to be included at the top of the program.
Syntax:
{$I Path\filename}
Example:
{$I U:\11sdd\edmond~1\example.pas}
Note: As Pascal is DOS based, it will not recognise more than 8 characters so the tilde
and numbers must be used to identify longer files.