Amos Professional Manual  Contents  Index

Control Structures


Here is a working example:

E> Input "Type values A,B and C: ";A,B,C
   If A=B
      Print "A equals B";
   Else
      Print "A is not equal to B";
      If A<>B And A<>C
         Print "or to C"
      End If
   End If

Note how each IF statement must be paired with a single END IF to inform AMOS Professional exactly which group of instructions is to be executed inside the test.

ELSE IF
structure: allow multiple structured tests
If condition Else If multiple conditions ... Else statement End If

This allows multiple tests to be performed. ELSE IF must be used within a normal IF ... END IF statement, and the only rule to remember is that there must be one ELSE just before the END IF. This sort of test waits for an expression, and if the expression is True, then what comes after it is executed. Here is an example:

X> If A=1
      Print "A=1"
   Else If A=2
      Print "A=2"
   Else If A=3
      Print "A=3"
   Else
      Print "Something Else"
   End If

If necessary, an entire test can be placed in a single line, as follows:

X> If A=1 : Print "A=1" : Else If A=2 : Print "A=2" : Else : Print "Something Else" : End If

When taking logical decisions, your Amiga understands the following character symbols, which are used as a form of short-hand:

Symbol  Meaning
=       equal to
<>      not equal to
>       greater than
>       less than
>=      greater than or equal to
<=      less than or equal to

There are also three functions that can be called during the decision making process.

Back    Next
05.04.05