8-74 Trio BASIC Commands
Program Loops and Structures
Trio Motion Technology
Example 2:
‘DO NOT EXECUTE SUBROUTINE AT label
STOP
label: PRINT var
RETURN
THEN
Type:
Program Structure
Description:
Forms part of an
IF
expression. See IF for further information.
Example:
IF MARK THEN
offset=REG_POS
ELSE
offset=0
ENDIF
Note:
Comments should not be placed after a
THEN
statement
TO
Type:
Program Structure
Description:
Precedes the end value of a
FOR..NEXT
loop.
Example:
FOR x=10 TO 0 STEP -1
UNTIL
Type:
Program Structure
Description:
Defines the end of a
REPEAT..UNTIL
multi-line loop, or part of a
WAIT UNTIL
struc-
ture. After the
UNTIL
statement is a condition which decides if program flow con-
tinues on the next line or at the REPEAT statement.
REPEAT..UNTIL
loops can be
nested without limit.
Example:
' This loop loads a CAMBOX move each time Input 0 comes on.
' It continues until Input 6 is switched OFF.