
13. Program Support Functions
13.5 User Macro Specifications
358
13.5.7 Control Commands
The flow of programs can be controlled by IF-GOTO- and WHILE-DO-.
Branching
Format
IF [conditional expression] GOTO n; (n = sequence number in the program)
When the condition is satisfied, control branches to "n" and when it is not satisfied, the next block is
executed.
IF [conditional expression] can be omitted and, when it is, control passes to "n" unconditionally.
The following types of [conditional expressions] are available.
#i EQ #j = When #i and #j are equal
#i NE #j
≠
When #i and #j are not equal
#i GT #j
> When #i is greater than #j
#i LT #j
< When #i is less than #j
#i GE #j
≥
When #i is #j or more
#i LE #j
≤
When #i is #j or less
"n" of GOTO n must always be in the same program. Program error (P231) will result if it is not. A
formula or variable can be used instead of #i, #j and "n".
In the block with sequence number "n" which will be executed after a GOTO n command, the
sequence number must always be at the head of the block.
Otherwise, program error (P231) will result.
If "/" is at the head of the block and Nn follows, control can be branched to the sequence number.
Branching to
N100 when
content of #2 is 1
N10 #22=#20 #23=#21;
IF [#2 EQ1] GOTO100;
#22=#20-#3;
#23=#21-#4;
N100 X#22 Y#23;
#1=#1+1;
Br
a
n
ch
s
earc
h
With
N10
To
head
Branch
search
N100
(Note 1)
When the sequence number of the branch destination is searched, the search is
conducted up to the end of the program (% code) from the block following IF············; and
if it is not found, it is then conducted from the top of the program to the block before
IF··········;. Therefore, branch searches in the opposite direction to the program flow will
take longer to execute compared with branch searches in the forward direction.
(Note 2)
EQ and NE should be used only for integers. For comparison of numeric values with
decimals, GE, GT, LE, and LT should be used.