EasyManua.ls Logo

Omron NJ Series - Page 287

Omron NJ Series
668 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
6 Programming
6-100
NJ-series CPU Unit Software User’s Manual (W501)
EXIT
Overview:
Use this statement only inside a repeat construct (FOR construct, WHILE construct, or REPEAT
construct) to exit the repeat construct.
Use this statement inside an IF construct to exit from the repeat construct when a condition is met.
Reserved Words:
EXIT
Construct Structure (e.g., in an IF Construct):
Application:
Use EXIT to end a repeating process before the end condition is met.
Description (e.g., in an IF Construct):
If the <condition_expression> is TRUE, the repeat construct (FOR construct, WHILE construct, or
REPEAT construct) is ended and all code inside the repeat construct after the EXIT statement is
ignored.
Note 1 You can also specify a BOOL variable instead of an expression for the condition expressions.
2 Even if the <condition_expression> is TRUE before <statement> is executed, <statement> is executed.
Example:
Variable n is repeatedly incremented by 1 from 1 to 50 while the value of n is added to array vari-
able elements DATA[n]. However, if DATA[n] exceeds 100, the repeat construct is exited.
Function Block Calls
Overview:
This statement calls a function block.
FOR (WHILE, REPEAT) <statement>
·
·
·
IF <condition_expression> THEN EXIT;
END_IF;
·
·
·
END_FOR (WHILE, REPEAT);
IF A THEN
DATA[3] :=98;
FOR n := 1; TO 50 BY 1 DO
DATA[n] := DATA[n] + n;
IF DATA[n] > 100 THEN EXIT;
END_IF;
END_FOR;
A :=FALSE;
END_IF;

Table of Contents

Other manuals for Omron NJ Series

Related product manuals