Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 327 of 909
If a=2, the SmartMotor™ will print "Lo there!" However, if a=1, the SmartMotor will print
both "Hiya!" and "Lo there!" There is no BREAK statement to stop the program from running
into case 2.
The BREAK statement can always be replaced by a GOTO statement, and this is how it is
actually executed using the precompiled program location. BREAK has the advantage of not
requiring a statement label to define the program branch location and, therefore, not
conforming to structured programming methodology.
BREAK is not a valid terminal command; it is only valid from within a user program. If you
want to be able to "break out of" a control block by remote (terminal) commands, you will
need to use GOTO# or GOSUB# with appropriate statement labels. The following example
illustrates this concept.
EXAMPLE:
a=1
WHILE a
PRINT("I am still here …",#13)
WAIT=12000
IF a==100
BREAK 'a=100 could be sent through serial command
ENDIF
LOOP
GOTO20
C10
PRINT("EXITED with a==100",#13)
END
C20
PRINT("EXITED with a<0",#13)
END
RELATED COMMANDS:
CASE formula Case Label for SWITCH Block (see page 355)
DEFAULT Default Case for SWITCH Structure (see page 382)
ENDS End SWITCH Structure (see page 435)
LOOP Loop Back to WHILE Formula (see page 522)
SWITCH formula Switch, Program Flow Control (see page 727)
WHILE formula While Condition Program Flow Control (see page 801)
Part 2: Commands: BREAK