17.CUSTOM MACRO PROGRAMMING B-63324EN/03
- 622 -
17.5 BRANCH AND REPETITION
In a program, the flow of control can be changed using the GOTO
statement and IF statement. Three types of branch and repetition
operations are used:
Branch and repetition GOTO statement (unconditional branch)
IF statement (conditional branch: if ..., then...)
WHILE statement (repetition while ...)
17.5.1 Unconditional Branch (GOTO Statement)
A branch to sequence number n occurs. When a sequence number
outside of the range 1 to 99999999 is specified, alarm PS0128 occurs.
A sequence number can also be specified using an expression.
GOTOn ; n : Sequence number (1 to 99999999)
[Example] GOTO 1;
Within a single program, do not specify multiple
blocks having the same sequence number.
Otherwise, when the GOTO statement causes a
branch, there is no guarantee that the program will
branch to the intended point. This is very dangerous.
1 Backward branching takes longer than forward
2 In the block having sequence number n to which
GOTOn causes a branch, the sequence number
must appear at the beginning of the block.
Otherwise, the branch fails.