Operators [ HP Pascal/iX Reference Manual ] MPE/iX 5.0 Documentation
HP Pascal/iX Reference Manual
Operators
An operator defines an action to be performed on one or more operands and
produces a value. An operator may be classified as arithmetic, Boolean,
relational, set, or concatenation. A particular symbol may occur in more
than one class of operators. For example, the symbol + is an arithmetic,
set, and concatenation operator representing numeric addition, set union,
and string concatenation, respectively. The class of the operator is
determined by the type of the operands.
Precedence ranking determines the order in which the compiler evaluates a
sequence of operators. For more information about precedence, refer to
the section on Operator Precedence in this chapter.
The value resulting from the action of an operator may in turn serve as
an operand for another operator. Table 4-2 lists each HP Pascal
operator together with its actions, permissible operands, and type of
results. In the table, the term real indicates both real and longreal
types and integer indicates any integral-type.
Table 4-2. HP Pascal Operators
---------------------------------------------------------------------------------------------
| | | | |
| Operator | Actions | Type of Operands | Type of Results |
| | | | |
---------------------------------------------------------------------------------------------
| | | | |
| + | addition | real, integer | real, integer |
| | set union | any set type | set |
| | concatenation | string, string literal| string |
| | | | |
---------------------------------------------------------------------------------------------
| | | | |
| - | subtraction | real, integer | real, integer |
| | set difference | any set type | set |
| | | | |
---------------------------------------------------------------------------------------------
| | | | |
| * | multiplication | real, integer | real, integer |
| | set intersection | any set type | set |
| | | | |
---------------------------------------------------------------------------------------------
| | | | |
| / | division | real, integer | real |
| | | | |
---------------------------------------------------------------------------------------------
| | | | |
| DIV | division with truncationinteger | integer |
| | | | |
---------------------------------------------------------------------------------------------
| | | | |
| MOD | modulus | integer | integer |
| | | | |
---------------------------------------------------------------------------------------------
| | | | |
| AND | logical 'and' | Boolean | Boolean |
| | | | |
---------------------------------------------------------------------------------------------
| | | | |
| OR | logical 'or' | Boolean | Boolean |
| | | | |
---------------------------------------------------------------------------------------------
| | | | |
| NOT | logical negation | Boolean | Boolean |
| | | | |
---------------------------------------------------------------------------------------------
| | | | |
| < | less than | any simple type | Boolean |
| | | string or PAC | Boolean |
| | | | |
---------------------------------------------------------------------------------------------
| | | | |
| > | greater than | any simple type | Boolean |
| | | string or PAC | Boolean |
| | | | |
---------------------------------------------------------------------------------------------
Table 4-2. HP Pascal Operators (cont.)
---------------------------------------------------------------------------------------------
| | | | |
| Operator | Actions | Type of Operands | Type of Results |
| | | | |
---------------------------------------------------------------------------------------------
| | | | |
| <= | less than or | any simple type | Boolean |
| | equal, | string or PAC | Boolean |
| | set subset | any set type | Boolean |
| | | | |
---------------------------------------------------------------------------------------------
| | | | |
| >= | greater than or | any simple type | Boolean |
| | equal, | string or PAC | Boolean |
| | set superset | any set type | Boolean |
| | | | |
---------------------------------------------------------------------------------------------
| | | | |
| = | equal to | any simple type | Boolean |
| | | string or PAC | Boolean |
| | | any set type | Boolean |
| | | pointer | Boolean |
| | | | |
---------------------------------------------------------------------------------------------
| | | | |
| <> | not equal to | any simple type | Boolean |
| | | string or PAC | Boolean |
| | | any set type | Boolean |
| | | pointer | Boolean |
| | | | |
---------------------------------------------------------------------------------------------
| | | | |
| IN | set membership | left operand: | Boolean |
| | | any ordinal type T | |
| | | right operand: | |
| | | set of T | |
| | | | |
---------------------------------------------------------------------------------------------
Operator Precedence
The precedence ranking of an HP Pascal operator determines the order of
its evaluation in an unparenthesized sequence of operators. The four
levels of ranking are:
PRECEDENCE OPERATORS
highest NOT
. *, /, DIV, MOD, AND
. +, -, OR
lowest <, <=, <>, =, >=, >, IN
The compiler evaluates higher precedence operators first. For example,
since * ranks above +, it evaluates these expressions identically:
(x + y * z) and (x + (y * z))
When a sequence of operators has equal precedence, the order of
evaluation is implementation dependent. If an operator is commutative,
for example, *, the compiler may evaluate the operands in any order.
Note that within a parenthesized expression the compiler evaluates the
operators and operands without regard for any operators outside the
parentheses.
Arithmetic Operators
Arithmetic operators perform integer and real arithmetic by taking
numeric operands and producing a numeric result. These operators are +,
-, *, /, DIV, and MOD.
Most arithmetic operators permit real, longreal, or integral-type
operands. However, DIV and MOD only accept integral-type operands. The
type of the result of a unary operator is the same as the type of its
operand. However, if the operand is bit16, the result is an integer
type, and if the operand is bit32 or bit52, the result is a longint. The
type of the result of a binary operator is the same as the data types of
its operands, provided that both operands are of the same type. Special
rules apply for division and in cases where operands have different data
types.
Implicit Type Conversion of Operands
The operators +, -, *, and / permit operands with different numeric
types. For example, it is possible to add an integer and a real number.
The compiler converts the integer to a real number, and the result of the
addition is real.
This implicit conversion of operands relies on a ranking of numeric
types. This is defined as follows:
RANK TYPE
highest longreal
. real, longint, bit52
. integer, bit32
lowest sub-integer
The rank of the value the result of an operation is the same as the
highest rank of all the operands. Operands having types whose ranks are
less than the rank of the type of the result are converted prior to the
operation, so that they have a type with a rank equal to that of the
result type.
For example, if i is an integer and x is a real in the expression (x +
i), then i is converted to real before the addition. In short, the two
operands to an arithmetic operator must be compatible. For more details,
refer to the section "Type Compatibility" .
Table 4-3. Type Comparisons and Results
---------------------------------------------------------------
| |
| Operand A Type Operand B Type Results |
| |
---------------------------------------------------------------
| |
| sub-integer sub-integer sub-integer |
| |
| sub-integer integer integer |
| |
| sub-integer real real |
| |
| integral-type longreal longreal |
| |
| integer real real |
| |
| integer super-integer longint |
| |
| integral-type longint longint |
| |
| longint real longreal |
| |
| real super-integer longreal |
| |
| real longreal longreal |
| |
| bit16 bit32 bit32 |
| |
| bit16 bit52 bit52 |
| |
| bit32 bit52 bit52 |
| |
---------------------------------------------------------------
Real division (/) is an exception to this restriction. If both operands
are integer or sub-integer, the compiler changes both to real numbers
prior to the division and the result is real. If both operands are
super-integers, the result is longreal because both[REV BEG] operands are
converted to longreal.[REV END]
Example
EXPRESSION RESULT
-(+10) -10 { Unary -. }
5 + 2 7 { Addition with integer operands. }
5 - 2.0 3.0 { Subtraction with implicit conversion. }
5 * 2 10 { Multiplication with integer operands. }
5.0 / 2.0 2.5 { Division with real operands. }
5 / 2 2.5 { Division with integer operands, real }
{ result. }
5.0 / 2 2.5 { Division with implicit conversion. }
5 DIV 2 2 { Division with truncation. }
5 DIV (-2) -2
-5 DIV 2 -2
-5 DIV (-2) 2
5 MOD 3 2 { Modulus. }
5 MOD (-2) error { Right operand must be positive. }
(-5) MOD 3 1 { Result is positive regardless of }
{ sign of left operand, which is }
{ parenthesized since MOD has higher }
{ precedence than -. }
{ See Operator Precedence. }
DIV
This operator returns the integer portion of the quotient of the dividend
and the divisor. The dividend must be an integral-type with no range
restriction. The divisor must also be an integral-type; the divisor
cannot be 0.
Example
INPUT RESULT
413 DIV 6 68
-413 DIV 6 -68
MOD
This operator returns the modulus of two integers. The dividend must be
an integral-type. The divisor must also be an integral-type. If the
divisor is less than or equal to 0, an error will occur. The result is
always positive, regardless of the sign of the left operand. The left
operand must be parenthesized if it is a negative literal. MOD is
defined as:
( i - k * j ) for some integer k
such that
0 <= i MOD j < j, j > 0
Example
INPUT RESULT
4 MOD 3 1
7 MOD 5 2
(-7) MOD 5 3
Boolean Operators
Boolean operators perform logical functions on Boolean type operands and
produce Boolean results. The Boolean operators are NOT, AND, and OR.
When both operands are Boolean, = denotes equivalence, <= implication,
and <> exclusive or.
The compiler can be directed to perform or not perform partial evaluation
of Boolean operators used in statements. For example:
IF right_time AND right_place THEN ...
By specifying the $PARTIAL_EVAL ON$ compiler directive, if right_time is
false, the remaining operators are not evaluated since execution of the
statement depends on the logical AND of both operators. Both operators
have to be true for the logical AND of the operators to be true.
Similarly, the logical OR of two operators are true even if only one of
the operators is true. Partial evaluation allows expressions like (Ptr
<> NIL) AND (Ptr^.F1) to execute without an error when Ptr is NIL.
Example
IF NOT possible THEN forget_it;
WHILE time AND money DO your_thing;
REPEAT...UNTIL tired OR bored;
IF has_rope THEN skip;
IF pain <= heartache THEN try_it;
FUNCTION NAND (A, B : BOOLEAN) : BOOLEAN;
BEGIN
NAND := NOT(A AND B); { NOT AND }
END;
FUNCTION XOR (A, B : BOOLEAN) : BOOLEAN;
BEGIN
XOR := NOT(A AND B) AND (A OR B); { EXCLUSIVE OR }
END;
FUNCTION XOR (A, B : BOOLEAN) : BOOLEAN;
BEGIN
XOR := A <> B;
END;
AND
This Boolean operator is used to perform the logical operation on two
Boolean operands. The result is of type Boolean. The following truth
table illustrates the operator AND along with its results.
OPERATOR RESULT
AND The evaluation of two Boolean operands produces a
Boolean result, such that:
(logical and)
----------------------------------------
| | | |
| a | b | a AND b |
| | | |
----------------------------------------
| | | |
| false | false | false |
| | | |
| false | true | false |
| | | |
| true | false | false |
| | | |
| true | true | true |
| | | |
----------------------------------------
Example
VAR
bit6, bit7 : Boolean;
counter : integer;
BEGIN
...
IF bit6 AND bit7 THEN counter := 0;
...
IF bit6 AND (counter = 0) THEN bit7 := true;
bit7 := bit6 AND (counter = 0);
END
NOT
This Boolean operator complements the value of the Boolean expression
following the NOT operator. The result is of type Boolean. The truth
table for NOT is given below.
OPERATOR RESULT
NOT The logical negation of a single Boolean operand,
such that:
(logical negation)
-----------------------------
| | |
| a | NOT a |
| | |
-----------------------------
| | |
| false | true |
| | |
| true | false |
| | |
-----------------------------
Example
PROGRAM show_not(input,output);
VAR
time, money : Boolean;
line : string[255];
test_file : text;
BEGIN
.
.
IF NOT (time AND money) THEN wait;
.
.
WHILE NOT eof(test_file) DO
BEGIN
readln(test_file,line);
writeln(line);
END;
.
.
END.
OR
This Boolean operator is used to perform the logical inclusive OR
operation on two Boolean operands. The result is the logical OR of its
two factors. The OR operator is shown below in terms of its truth table.
OPERATOR RESULT
OR The evaluation of two Boolean operands produces a
Boolean result, such that:
(inclusive or)
----------------------------------------
| | | |
| a | b | a OR b |
| | | |
----------------------------------------
| | | |
| false | false | false |
| | | |
| false | true | true |
| | | |
| true | false | true |
| | | |
| true | true | true |
| | | |
----------------------------------------
Example
PROGRAM show_or(input,output);
VAR
ch : char;
time : Boolean;
energy : Boolean;
BEGIN
.
.
IF time OR energy THEN do_it;
.
.
IF (ch = 'Y') OR (ch = 'y') THEN ch := 'Y';
.
.
END.
Relational Operators
Relational operators compare two operands and return a Boolean result.
The relational operators are <, <=, =, <>, >=, >, and IN. The following
lists the relational operators with their associated meanings:
OPERATOR MEANING
< less than
<= less than or equal to
= equal
<> not equal
>= greater than or equal
> greater than
IN set membership
Depending on the type of its operands, a relational operator may be
classified as simple, set, pointer, or string. For a description of
simple, set, pointer, or string relational operators, refer to the
appropriate section in this chapter.
Simple Relational Operators
A simple relational operator has operands of any simple type such as
integer, Boolean, char, real, longreal, enumerated, or subrange. All the
operators listed above, except IN, may be simple relational operators.
The operands must be type compatible, but the compiler may implicitly
convert numeric types before evaluation. For more information about
converting numeric types, refer to the section "Arithmetic Operators"
in this chapter.
For numeric operands, simple relational operators impose the ordinary
definition of ordering. For char operands, the ASCII collating sequence
defines the ordering. For enumerated operands, the sequence in which the
constant identifiers appear in the type definition defines the ordering.
If both operands are Boolean, the operator = denotes equivalence, <=
denotes implication, and <> denotes exclusive OR. Therefore, the
predefinition of Boolean as:
TYPE Boolean = (false, true);
means that false < true.
Example
PROGRAM show_simple_relational;
VAR
b: Boolean;
BEGIN
.
.
b := 5 > 2;
b := 5 < (25.OL+1);
END.
Set Relational Operators
A set relational operator has set operands. The set relational operators
are =, <>, >=, <=, and IN. The operators = and <> compare two sets for
equality or inequality, respectively. The <= operator denotes the subset
operation, while >= indicates the superset operation such that Set A is a
subset of Set B, if every element of A is also a member of B. When this
is true, B is said to be the superset of A.
The IN operator determines if the left operand is a member of the set
specified by the right operand. When the right operand has the type SET
OF T, the left operand must be type compatible with T. To test the
negative of the IN operator, the following form must be used:
NOT (element IN set)
Example
PROGRAM show_set_relational; (output)
TYPE
color= (red,yellow,blue);
VAR
b: boolean;
s,t: SET OF color;
col: color;
BEGIN
col:= red;
s:= [red];
t:= [blue];
b:= s <> t;
writeln (b);
b:= s <= t;
writeln (b);
b:= col IN [yellow,blue];
writeln (b);
END.
Output:
TRUE
FALSE
FALSE
IN.
This operator returns true if the specified element is a member of the
specified set. The result is false if the expression is not a member of
the set. Both the element being tested and the elements in the set must
be of compatible types.
Example
PROGRAM show_in(output);
VAR
ch : char;
good : SET OF char;
member : Boolean;
BEGIN
ch := 'y';
good := ['y','Y','n','N'];
IF ch IN good THEN
member := true
ELSE
member := false;
writeln(member);
END.
Output:
TRUE
Pointer Relational Operators
The pointer relational operators = and <> can be used to compare two
pointers for equality or inequality, respectively. Two pointers are
equal only if they point to exactly the same object or both contain the
value NIL. Only two pointers of identical type or the constant NIL can be
compared.
Example
PROGRAM show_pointer_relational;
VAR
a, b: boolean;
p, q: ^boolean;
x: ^char;
BEGIN
.
.
IF (p = q) AND (p <> NIL) THEN p^:= a = b; { pointer }
b := x <> q; { is an error - x and q are not compatible }
END.
NOTE No assumptions should be made about the integer values of pointers
and their integer value relations. Such values and relations are
undefined.
String Relational Operators
The string relational operators =, <>, <, <=, >, or >= may be used to
compare operands of type string, PAC, char, or string literals. The
system performs the comparison character by character using the order
defined by the ASCII collating sequence. Note that it is not possible to
compare a string variable with a PAC or char variable. In general, these
guidelines are as follows:
* If one operand is a string expression, the other operand may be a
string expression or string literal. If the operands are not the
same length and the two are equal up to the length of the shorter,
the shorter operand is less. For example, if the current value of
S1 is abc and the current value of S2 is ab, then S1 > S2 is true.
* If one operand is a PAC expression, the other may be a PAC or
string literal of any length. The shorter is blank-filled prior
to comparison.
* If one operand is a char expression, the other may be a char
expression or a single-character string literal.
Table 4-4 summarizes these rules. The standard function strmax(s)
returns the maximum length of the string variable s. The standard
function strlen(s) returns the current length of the string expression s.
A string constant is considered a string literal when it appears on
either side of a relational operator.
Table 4-4. String, PAC, Char, String Literal Comparison
-----------------------------------------------------------------------------------------------------
| | | | | |
| A <relop> B | string | PAC | char | string literal |
| | | | | |
-----------------------------------------------------------------------------------------------------
| | | | | |
| string | Length of | Not allowed | Not allowed | Length of |
| | comparison | | | comparison |
| | based on | | | based on |
| | smaller strlen | | | smaller strlen |
| | | | | |
-----------------------------------------------------------------------------------------------------
| | | | | |
| PAC | Not allowed | The shorter | Not allowed | The shorter |
| | | of the two | | of the two |
| | | is padded | | is padded |
| | | with blanks | | with blanks |
| | | | | |
-----------------------------------------------------------------------------------------------------
| | | | | |
| char | Not allowed | Not allowed | Yes | Only if |
| | | | | strlen(B)=1 |
| | | | | |
-----------------------------------------------------------------------------------------------------
| | | | | |
| string literal | Length of | The shorter | Only if | The shorter |
| | comparison | of the two | strlen(A)=1 | of the two |
| | based on | is padded | | is padded |
| | smaller strlen | with blanks | | with blanks |
| | | | | |
-----------------------------------------------------------------------------------------------------
Example
PROGRAM show_string_relational (output) ;
VAR
s,t: string[80];
pac: packed array [1..5] of char;
chr: char;
b: boolean;
BEGIN
s:='abc';
t:='ab';
if s > t then b:=true {string to string comparison. this is}
else b:=false; { the same as b:= s > t }
writeln (b);
b:= s > 'ab'; {string to string literal comparison }
writeln (b);
pac:='abc';
b:= pac > 'abc'; {PAC to string literal comparison }
writeln (b);
chr:= 'A';
b:= 'c' > chr; {char to string literal comparison }
writeln (b);
END.
Output:
TRUE
TRUE
FALSE
TRUE
Concatenation Operator
The concatenation operator + concatenates two operands that may be string
variables, string literals, function results of a string type, or some
combination of these types. The result of the concatenation is always
type string.
NOTE It is not legal to use the concatenation operator in a constant
definition.
Example
VAR
s1,s2: string[80];
BEGIN
s1:='abc';
s2:='def';
s1:= s1 + s2; { s1 is now 'abcdef' }
writeln('s1 has: ',s1);
s2:= 'The first six letters are ' + s1;
writeln('s2 has: ',s2);
END.
Output:
s1 has: abcdef
s2 has: the first six letters are abcdef
SET Operators
The set operators perform set operations on two set operands. The result
is of type set. The set operators are +, -, and *. Operands used with
set operators may be variables, constant identifiers, or set
constructors. The base types of the set operands must be type compatible
with each other.
OPERATOR RESULT
+ (union) A set whose members are all the elements present in
the left set operand and those in the right,
including members present in both sets.
- (difference) A set whose members are the elements which are
members of the left set but are not members of the
right set.
* (intersection) A set whose members are only those elements present
in both of the set operands.
Example
PROGRAM show_setops;
VAR
a, b, c: SET OF 1..10;
x : 1..10;
BEGIN
.
.
a:= [1, 3, 5];
b:= [2, 4];
c:= [1..10];
x:= 9;
a:= a + b; { Union; a is now [1, 2, 3, 4, 5]. }
b:= c - a; { Difference; b is now [6, 7, 8, 9, 10]. }
c:= a * b; { Intersection; c is now []. }
c:= [2, 5] + [x] { Set constructor operands; c is now }
END. { [2, 5, 9]. }
Array Selector
An array selector accesses a component of an array. The selector follows
an array designator and consists of an ordinal expression in square
brackets. For a string or PAC type, an array selector accesses a single
component; for example, a character.
The ordinal expressions must be assignment compatible with the index
types of the array. An array designator can be any variable with an
array type that includes an array selector, a function call that returns
an array, or an array constant. The symbols (. and .) may replace the
left and right brackets, respectively. The list can be used to select a
component of a multiple-dimensioned array.
Syntax
Array_selector:
Example
PROGRAM show_arrayselector;
TYPE
a_type = ARRAY [1..10] OF integer;
VAR
m,n : integer;
s_array : ARRAY [1..3] OF 1..100;
multi_array : ARRAY [1..5,1..10] OF integer;
p : ^a_type;
BEGIN
s_array[2]:= 32;
m:= s_array[2]; { Assigns current value of 2nd }
{ component of s_array to m }
multi_array[2,9]:= m; { These two methods of }
multi_array[2][9]:= m; { assignment are equivalent. }
new(p);
p^[1]:= 1200;
n:= p^[m MOD 10 + 1] * m; { Array in the heap with computed }
END. { selector. }
Record Selector
A record selector accesses a field of a record. The record selector
follows a record designator and consists of a period and the name of a
field. A record designator is the variable name of a record, the
selected component of a structure that is a record, or a function call
that returns a record.
The WITH statement "opens the scope" of a record. This makes it
unnecessary to specify a record selector.
Syntax
Record_selector:
Example
PROGRAM show_recordselector;
TYPE
r_type = RECORD
f1: integer;
f2: char;
END;
VAR
a,b : integer;
ch : char;
r : r_type;
rec_array : ARRAY [1..10] OF r_type;
BEGIN
.
a:= r.f1 + b; { Adds the current value of integer field }
. { of r to b and assigns the result to a. }
.
rec_array[a].f2:= ch; { Assigns current value of ch to char }
. { field of the a'th component of rec_array. }
END.
Set Constructor
A set constructor designates one or more values as members of a set whose
type may or may not have been previously declared. A set constructor
consists of an optional set type identifier and one or more ordinal
expressions in square brackets. Two expressions may serve as the lower
and upper bound of a subrange.
If the set type identifier is specified, the values in the brackets must
be assignment compatible with the base type of the set. If no set type
identifier appears, the values must be type compatible with each other.
The symbols (. and .) may replace the left and right brackets,
respectively.
Set constructors may appear as operands in expressions in executable
statements. Set constructors with constant values are legal in the
constant declaration sections.
A set constructor of the form [i..j] where i and j are integral-type
variables, is defaulted to a set of integer (set of 0..255). If it
appears in an expression and the size of the other operand is larger than
zero to 255, [i..j] is assumed to be the size of the other operand.
Syntax
Set_constructor:
Example 1
PROGRAM show_setconstructor;
TYPE
int_set = SET OF 1..100;
cap_set = SET OF 'A'..'Z';
VAR
a,b: 0..255;
s1: SET OF integer;
s2: SET OF char;
BEGIN
.
.
s1:=[b, 7, 10]; { no type identifier }
s1:= int_set[(a MOD 100) + (b MOD 100)];
s2:= cap_set['B'..'T', 'X', 'Z'];
END.
Example 2
VAR
s1 : set of 0..366;
i,j : integer;
BEGIN
s1 := [i..j] * s1; {in this context, [i..j] becomes a set of 0..366.}
.
.
.
END.
File Buffer Selector
A file buffer selector accesses the contents, if any, of the file buffer
variable associated with the current position of a file. The selector
follows a file designator and consists of the caret symbol (^).
A file designator is the name of a file or the selected component of a
structure which is a file. The @ symbol may replace the caret. If the
file buffer variable is not defined at the time of selection, a run-time
error occurs.
Syntax
File_selector:
Example
PROGRAM show_file_selector(output);
VAR
f1: FILE OF integer;
BEGIN
rewrite(f1);
f1^:= 5;
put(f1);
reset(f1);
IF f1^ <> 5 THEN
writeln('error')
ELSE
writeln('success');
END.
Output:
success
Pointer dereferencing
A pointer variable points to a dynamically allocated variable on the
heap. The current value of this variable may be accessed by
dereferencing its pointer value. Pointer dereferencing occurs when the
caret symbol (^) appears after a pointer designator in source code. A
dereferenced pointer can be an operand in an expression.
The pointer designator may be the name of a pointer or selected component
of a structured variable that is a pointer. The @ symbol may replace the
caret. It is an error to dereference NIL or an undefined pointer value.
Syntax
Pointer_deref:
Example
PROGRAM show_pointerderef (output);
TYPE
p = ^integer;
VAR
a,b : integer;
p_array : ARRAY [1..10] OF p;
ptr : p;
BEGIN
.
p_array[a]^:= a + b;
.
writeln(ptr^ * 2); { Dereferenced pointer is operand. }
.
END.
Function Calls
A function call invokes the block of a standard or user defined function
and returns a value to the calling point of the program. An operator can
perform some action on this value, and, for this reason, a function
result is an expression. See Chapter 8 for a complete description of
function calls.
Example
PROGRAM show_function_call;
VAR x: integer;
FUNCTION sum (A,B: integer): integer;
BEGIN
sum := A + B;
END;
BEGIN
x:= sum (1,2) + 3;
x:= sum(x,sum(x,sum(0,1)));
END.
MPE/iX 5.0 Documentation