Amos Professional Manual  Contents  Index

Control Structures


program exactly where you left it. In such circumstances, the POP command can be used to remove the return address generated by a GOSUB, allowing you to leave the sub-routine without the final RETURN statement being executed. For example:

E> Do
    Gosub THERE
   Loop
   HERE:
   Print "I've just popped out!"
   Direct : Rem No risk of accidental subroutine
   THERE:
   Print "Hello There!"
   If Mouse Key Then Pop : Goto HERE
   Return

Decision making
The command words used in the decision making process have very similar meanings in AMOS Professional as they do in normal English.

IF
THEN
structure: choose between alternative actions
If conditions Then statements

The IF ... THEN structure allows simple decisions to be made within a program, so IF a condition is true THEN the computer decides to take a particular course of action. If the condition is not true, the machine does something else. For example:

E> NIGHT=12
   DAY=12
   Print "What time is it now?" : Wait 150
   If NIGHT=DAY Then Goto BED
   Print "Time I bought a watch"
   Goto WATCHMAKER
   BED:
   Print "I think it is bed time"
   WATCHMAKER:

AND
OR
structures: qualify a condition
If condition And condition Then statement
If condition Or condition Then statement

Back    Next
05.04.03