Amos Professional Manual  Contents  Index

Control Structures


TRUE
FALSE
functions: hold value of -1 (True) and zero (False)
value=True
value=False

In all the conditional operations such as IF ... THEN and REPEAT ... UNTIL, the value of -1 is used to represent TRUE, and the value of 0 is used to represent FALSE. A value of either -1 (True) or 0 (False) is produced every time a test is made to satisfy a condition.

NOT
structure: toggle binary digits
value=Not digits

NOT is used to swap over every digit in a binary number from a 0 to a 1, and vice versa. For example:

E> Print Bin$(Not%11110000,8)

Since -1 (True) can be expressed in binary as %1111111111111111, then NOT TRUE must be equal to FALSE, and a logical NOT operation is achieved.

SWAP
structure: swap the contents of two variables
Swap a,b
Swap a#,b#
Swap a$,b$

Use the SWAP command to swap over the data between any two variables of the same type. For example:

E> A=10 : B=99: Print A,B
   Swap A,B : Print A,B

Using loops
To write a separate routine for dozens of logical choices, and to end up with dozens of END IFs is not only messy, but also extremely tedious. AMOS Professional offers all of the expected programming short-cuts to allow sections of code to be repeated as often as necessary. These repeated parts of programs are known as "loops".

DO
LOOP
structure: keep repeating a list of statements
Do
list of statements
Loop

Back    Next
05.04.06