2-33
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
ST Statement Instructions
2
WHILE
The following processing flow is for this example. You can use more than one statement.
WHILE condition expression DO
statement;
END_WHILE;
• The statement is not executed even once if the condition expression is FALSE the first time it is eval-
uated.
• There are no restrictions on the statements that you can use. You can use the same types of state-
ments for the statements in the WHILE construct as you do for the statements outside the WHILE
construct. For example, you can use function block calls and FOR constructs.
• You must always use WHILE and END_WHILE. They must be paired.
• You can use a hierarchy that is 15 levels deep, but count all levels of IF, CASE, FOR, WHILE, and
REPEAT constructs.
This example adds INT#7 to variable abc as long as the value of variable abc is less than or equal to
INT#1000.
Additional Information
Precautions for Correct Use
Sample Programming
FALSE
TRUE
Statement
Condition
expression
abc:=INT#0;
WHILE abc<=INT#1000 DO
abc:=abc+INT#7;
END_WHILE;
abc 0
INT
Variable
Data type
Initial value