Previous: Import Units To the Table of Content Next: Declaration

- 2.2.12 -
TMT Pascal Language Description
Pascal Language Structure

Procedures and Functions

Procedures are a sequence of instructions that are separate from the main code block. Functions are procedures that return a value. Other than this difference, both procedures and functions are the same.

Procedures are blocks of code that are called from one or more places throughout your program. Procedures make source code more readable and reduce the size of the executable because repetitive blocks of code are replaced with a call to a procedure. Both procedures and functions accept parameters. Parameters allow the calling routine to communicate with a procedure.

Parameters can be passed by value or by reference or by constant reference.

If passed by value, only the value of the parameter is passed and the procedure has no access to the actual variable. One can modify the value parameter. It will have an effect only inside of the procedure body and will not change the actual variable.

If passed by reference, also known as var parameters, an address of the memory location containing the value is passed thus making it possible to modify the variable.

If passed by constant reference, also known as const parameters, an address of the memory location containing the value is passed but the compiler does not allow one to modify a constant parameter and does not allow passing one as an actual variable parameter to another procedure or function.

Procedures and Functions Declaration
Forward Declaration
External Declaration
Interrupt Procedure
Procedural Value
Using Statement as Procedure


Previous: Import Units To the Table of Content Next: Declaration
Import Units Table of Content Declaration

- 2.2.12 -