 |
|
Procedures and functions-referred to collectively
as routines-are self-contained statement blocks that can be called
from different locations in a program. A function is a routine that
returns a value when it executes. A procedure is a routine that
does not return a value.
Function calls, because they return a value, can be used as
expressions in assignments and operations. For example,
I :=
SomeFunction(X);
calls SomeFunction and assigns the
result to I. Function calls cannot appear on the left side of an
assignment statement.
Both function and procedure calls can be used as complete
statements. For example,
DoSomething;
calls the DoSomething routine; if
DoSomething is a function, its return value is discarded.
Procedures and functions can call themselves recursively.
Before learning how to declare functions and procedures you must
know something about paramater list.
|