Contents | Prev | Next | Index


Relational Operators

= equal
# unequal
< less
<= less or equal
> greater
>= greater or equal
IN set membership
IS type test

Relations yield a BOOLEAN result. The relations =, #, <, <=, >, and >= apply to numeric types, CHAR, (possibly open) character arrays, and strings. The relations = and # also apply to BOOLEAN and SET, as well as to pointer types and procedure types (including the value NIL). x IN s stands for "x is an element of s". x must be of an integer type and s of type SET. v IS T stands for "the dynamic type of v is T (or an extension of T)" and is called a type test. It is applicable only if

  1. v is a variable parameter of record type or v is a pointer to record, and if
  2. T is an extension of the static type of v.

The following are examples of expressions (refer to examples in the section about variable declarations):

1991 INTEGER
i DIV 3 INTEGER
~p OR q BOOLEAN
(i+j)*(i-j) INTEGER
s-{8,9,13} SET
i+x REAL
a[i+j]*a[i-j] REAL
(0<=i) & (i<100) BOOLEAN
t.key = 0 BOOLEAN
k IN {i..j-1} BOOLEAN
w[i].name <= "John" BOOLEAN
t IS CenterTree BOOLEAN

 


Contents | Prev | Next | Index

Canterbury Oberon-2 for JVM  (Last documentation update Jun 2, 2000)
Copyright © 1998 Mill Hill & Canterbury Corporation, Ltd. All rights reserved
Please send any comments or corrections to mhc@webcom.com