Amos Professional Manual  Contents  Index

Control Structures


As before, an optional number can be given to specify the number of loops to be jumped from, otherwise only the current loop will be aborted. For example:

E> While L=0
    A=0
    Do
     A=A+1
     For X=0 To 100
      Exit If A=10,2 : Rem Exit from DO and FOR loops
     Next X
    Loop
    Exit 1: Rem Exit from WHILE loop
   Wend

Conditional loops

WHILE
WEND
structure: repeat loop while condition is true
While condition
list of statements
Wend

This pair of commands provides a convenient way of making the program repeat a group of instructions all the time a particular condition is true. WHILE marks the start of this loop, and the condition is checked for a value of -1 (True) from this starting position through to the end position, which is marked by a WEND. The condition is then checked again at every turn of the loop, until it is no longer true. For example:

E> BLAZES:
   Print "Please type in the number 9"
   Input X
    While X=9
     Cls : Print X : Wait 50 : Goto BLAZES
    Wend
   Print "That is not a 9!"

You are free to use AND, OR and NOT to qualify the conditions to be checked.

REPEAT
UNTIL
structure: repeat loop until a condition is satisfied
Repeat
list of statements
Until condition

Back    Next
05.04.08