Expressions Used by Flow Control

For flow control, conditions such as if-then-else, while-do, and do-while request Boolean expressions. A set of predefined functions is available. Each function works on specific types or a set of types.

This page discusses:

Global Functions and Instructions

The global functions and examples follow.

Operator Type Result
= Equality operator
A=B
Returns true if the value of A and B are equal.
Note: Always true if A and B are pure.
<> Inequality operator
A<>B
Returns true if the value of A and B differ.

Examples

IO_Double1 = 5
IO_Double1 = IO_Double2
IO_Double2 <> 5
IO_Double2 <> IO_Double2

Boolean Functions

The Boolean functions and examples follow.

Type Result
not
not A
Returns true if the value of A is true.
Returns false if the value of A is true.
and
A and B
Returns true if A and B are true.
Returns false otherwise.
or
A or B
Returns true if the value of A or the value of B are true.
Returns false otherwise.

Examples

IO_Boolean
not IO_Boolean
not IO_Boolean1 and not IO_Boolean2
not (IO_Boolean1 and not IO_Boolean2)
IO_Boolean1 or IO_Boolean2
Note: xor is not supported.

Orderable Class Functions

The orderable class functions and examples follow.

Type Result
<
A<B
Returns true if the value A is less than B.
>
A > B
Returns true if the value A is greater than B.
<=
A <= B
Returns true if the value A is less than or equal to B.
>=
A >= B
Returns true if the value A is greater than or equal to B.
max
max (x,y)
Returns x if x is greater than y.
min
min (x,y)
Returns x if x is less than y.

Examples

IO_Double1 > 5
IO_Double1 > 5 and IO_Double1 < 10 or IO_Boolean
min (5, IO_Double2) >= IO_Double1

Numerical Functions: Class Number

The numerical functions for the class number and examples follow.

Type Result
+
Addition
x+y
-
Subtraction
x-y
*
Multiplication
x*y
/
Division
x/y
**
Raising to a power, or exponentiation
x**y
abs
absolute value of x
abs(x)

Examples

(IO_Double1 + IO_Double2) > 5
abs (IO_Double) = 5
(IO_Double1 ** IO_Double2) > 100

Mathematical Function: Class Integer

The mathematical function for the class integer follows.

Type Result
mod(x,y) Modulo

Mathematical Functions: Class Floating

The mathematical functions for the class floating follows.

Type Result
sin(x) Sine of input in radian
cos(x) Cosine of input in radian
tan(x) Tangent of input in radian
asin(x) Principal arc sine in the interval [-pi/2, +pi/2]
acos(x) Principal arc cosine in the interval [0, pi]
atan(x) Principal arc tangent in the interval [-pi/2, +pi/2]
atan2(x,y) Principal arc tangent in the interval [-pi, +pi]
sinh(x) Hyperbolic sine of the input in radian

Other Function

Another function and an example follow.

Type Result
if expr1 then expr2 else expr3 If expr1 is true, returns expr2. Otherwise, returns expr3

Example

if (IO_Double1 + IO_Double2 < 40) then true else false