
B-63944EN/02 PROGRAMMING 16.CUSTOM MACRO
- 425 -
16.6.3 Conditional Branch (IF Statement)
Specify a <conditional expression> after IF.
IF[<conditional expression>]GOTOn
If the specified <conditional expression> is satisfied (true), a branch to
sequence number n occurs. If the specified condition is not satisfied,
the next block is executed.
If the value of variable #1 is greater than 10, a branch to sequence number
N2 occurs.
IF[<conditional expression>]THEN
If the specified <conditional expression> is satisfied (true), a macro
statement specified after THEN is executed.
Only a single macro statement is executed.
If the values of #1 and #2 are the same, 0 is assigned to #3.
IF[#1 EQ #2] THEN#3=0 ;
If the values of #1 and #2 are the same and those of #3 and #4 are also
the same, 0 is assigned to #5.
IF[[#1 EQ #2] AND [#3 EQ #4]] THEN#5=0 ;
If the values of #1 and #2 are the same or those of #3 and #4 are the
same, 0 is assigned to #5.
IF[[#1 EQ #2] OR [#3 EQ #4]] THEN#5=0 ;
Explanation
- <Conditional expression>
<Conditional expressions> are divided into <simple conditional
expressions> and <complex conditional expressions>. In a <simple
conditional expression>, a relational operator described in Table 16.6
(a) is specified between two variables or between a variable and
constant to be compared. An <expression> can be used instead of a
variable. With a <complex conditional expression>, an AND
(logical AND), OR (logical OR), or XOR (exclusive OR) operation is
performed for the results (true or false) of multiple <simple
conditional expressions>.
If the condition
is not satisfied
IF [#1 GT 10] GOTO 2 ;
N2 G00 G91 X10.0 ;
:
Processing If the condition is satisfied