The Function
The syntax for an EQUEL/Pascal function is:
function function_name [(formal_parameters)] : return_type_name
[declarations]
begin
[statements]
end;
Syntax Notes:
1. The function_name is not processed by EQUEL.
2. Formal parameters and variables declared in a function are visible to the function and to any nested blocks.
4. EQUEL does not allow function calls to replace variables in executable statements. Therefore, EQUEL need not know the return_type_name.
The following is an example of a function:
## function WasError( errorBuf : varying[ub] of
## Char ) : Boolean;
## const
## EquelNoError = 0;
## var
## errNum : Integer;
## begin
## INQUIRE_EQUEL (errNum = error)
if errNum = EquelNoError then
begin
errorBuf := ' ';
WasError := FALSE;
end else
begin
SetErrorBuf( errNum, errorBuf );
WasError := TRUE;
end;
## end;