AMOS - The Creator User Guide - eBook-ENG

Page 92

II Do

Do

Print "Inner loop" If Mouse Key =1 Then Exit If Mouse Key=2 Then Exit 2 Wait 5 : Rem Slow loop so you can see it running Loop Locate 20, : Print "Outer loop" Wait 5 Loop

EXIT IF

(Exit from

a loop depending on a test)

EXIT IF expression[,n] As you can see from the previous EXIT instruction, it's often necessary to terminate a loop depending on the outcome of a specific set of conditions. This is simplified using a special EXIT IF command. expression consists of a series of tests in the standard AMOS format. The EXIT will only be performed if the result evaluates to -1 (true). The n parameter allows you to quit from several loops at the same time. If it's omitted then only the current loop will be aborted. Example:

While L=O Z=O

Do

Z=Z+1 For X=O To 100 Exit If Z=1 0,2 : Rem Exits two Loops, DO and FOR Next X Loop Exit 1 : Rem Terminates While •••Wend Wend

EDIT

(Stop running the program and return to the Editor)

II II

II II II II II II II

I

EDIT The EDIT directive stops the current program and returns to the AMOS Basic editor. This can be very useful when you are debugging one of your programs.

01 R EeT

II II

(Exit to direct mode)

DIRECT DIRECT terminates your program and jumps immediately back to the direct mode. You can now examine the contents of your variables or list your programs out to the printer.

II

80

II


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.