HP 3000 Manuals

FUNCTION [ HP Pascal/iX Reference Manual ] MPE/iX 5.0 Documentation


HP Pascal/iX Reference Manual

FUNCTION 

A function is a block that is invoked with a function call and that
returns a value.  A function declaration consists of a function heading,
a semicolon (;), and a block or a directive followed by a semicolon (;).

A function heading consists of the reserved word FUNCTION, an identifier
that specifies a function name, an optional formal parameter list, and a
result type.  The result type may be any type, except a file type or a
structured type containing a file.

A directive can replace the function block to inform the compiler of the
location of the block; for example, FORWARD. Other directives are
implementation dependent.  See the HP Pascal/iX Programmer's Guide or the
HP Pascal/HP-UX Programmer's Guide, depending on your implementation, for
information on other directives.  In the body of a function block there
must be at least one statement assigning a value to the function
identifier.  This assignment statement determines the function result.
If the function result is a structured type, a value must be assigned to
each of its components using an appropriate selector.

Function declarations may occur at the end of a declaration section after
label, constant, type, variable declarations, and MODULE declarations at
the outer level.  Function declarations may be intermixed with procedure
declarations.

Syntax 

     Function_declaration:

[]


MPE/iX 5.0 Documentation