11. Robot Language Explanation
------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
11 - 19
11.2.4.10 IF∼ELSEIF∼ELSE∼ENDIF Command
11.2.4.11 FOR∼NEXT Commands
Description Jumps according to the Condition.
Syntax
IF <Condition> THEN <Address> [ELSE <Address>]
IF<Condition> THEN
∼
[ELSEIF <Condition>
∼ ] (Several Times)
[ELSE
∼ ]
ENDIF
Condition
file
Arithmetic Equation, String Condition
If 0, false
If not 0, true.
Parameter
Address
THEN : If condition is satisfied, jump.
ELSE : If condition is not satisfied, jump.
example
IF V2!>SQR(V50!^2+V51!^2) THEN 150 ELSE *AGAIN (Example of simple if
instruction)
IF DI1>=10 THEN (Example of complex if
instruction)
PRINT #0, "HIGH"
PRINT #1, "HR-MSG: HIGH"
ELSEIF DI1>=0
PRINT #0, "LOW"
ELSE
GOTO *ERR
ENDIF
Description
Repeats the block incrementing the variable value as long as it is smaller
or the same as the end value.
Syntax
FOR <Variable>=<Initial Value> TO <End Value> [STEP <Increment>] ∼
NEXT
Variable
Arithmetic Variable. Variable for determining the
re
p
etition.
Initial
Value
Arithmetic Equation. Initially set value for variable
End Value
Arithmetic Equation. Repeats only if the variable value
is smaller or the same as the end value.
Parameter
Increment Arithmetic Equation. Increment value for the variable
example
REM -- Moves toward the shift direction gradually slowing down.
FOR V1!=300 TO 0 STEP -33.3
P1=P1+R1
MOVE L, P1, S=V1!mm/sec,A=3,H=1 UNTIL DI1
NEXT