If Goto Else ( Selects A Branch Destination According To The Result Of An Expression ) - Mitsubishi QD51 Programming Manual

Logic controller
Hide thumbs Also See for QD51:
Table of Contents

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
IF GOTO ELSE
• Selects a branch destination according to the result of an expression.
IF
<conditional expression>
Syntax
number> ]
conditional expression
line number
instruction/line number
IF X> Y GOTO 100 ELSE
Examples
END
IF X=0 GOTO 100 ELSE
200
• The IF to GOTO to ELSE instruction selects the execution according to the result of the
Description
expression.
• If the condition of <conditional expression> is true, the instruction after GOTO is executed
and the instruction after ELSE is ignored.
• If the condition of <conditional expression> is false, the instruction after GOTO is ignored
and the instruction after ELSE is executed.
The execution moves to the instruction of the next line if ELSE is not specified.
• <line number> can also be specified by a label.
• The IF instruction can be nested by writing a separate IF instruction after ELSE.
Example IF <conditional expression 1)> GOTO 100 100 ELSE IF <conditional
11 - 84
Instruction
IF to GOTO to ELSE
expression 2)> GOTO 200 ELSE 300
Conditional
expression
1)
YES
Line 100
GOTO <line number> [ ELSE <instruction> / <line
• • • •
Specify with a relational operation expression (<, >,
=).
• • • •
Specify a line number of execution destination that is
executed when the conditional expression is true.
• • • •
Specify the instruction that is executed when the
conditional expression is false, or a line number of
execution destination.
• • • •
Branches to line 100 when X is greater than Y.
Otherwise, terminates the program execution.
• • • •
Branches to line 100 if X is 0. If X is not 0, branches
to line 200.
NO
Conditional
expression
2)
YES
Line 200
MELSEC-Q
NO
Line 300
11 - 84

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents