6-97
6 Programming
NJ-series CPU Unit Software User’s Manual (W501)
6-5 Programming Languages
6
6-5-3 Structured Text Language
* You must use the same data type for the <FOR_variable>, <end_value> and <increment/decrement>. Otherwise,
an error occurs when the program is built on the Sysmac Studio.
WHILE
Overview:
This construct repeatedly executes the specified statements as long as a condition expression is
TRUE.
Reserved Words:
WHILE, DO, END_WHILE
Construct Structure:
Process Flow Diagram:
Application:
Use this type of repeat construct when you do not know how many times to repeat a process (i.e.,
when you do not know how many times based on the condition) and you want to repeat a process
for as long as a certain condition is met. You can also use this type of repeat construct to execute a
process only when a condition expression is TRUE (pre-evaluation repeat construct).
Description:
The <condition_expression> is evaluated before <statement> is executed.
If <condition_expression> is TRUE, <statement> is executed. Then the <condition_expression> is
evaluated again. This process is repeated.
If the <condition_expression> is FALSE, <statement> is not executed and the
<condition_expression> is no longer evaluated.
Derivative data types
Structures
Structures Not supported.
Members
Supported for integers and enu-
merations only.
Unions
Unions Not supported.
Members
Supported for integers and enu-
merations only.
Enumerations Supported.
WHILE <condition_expression> DO
<statement>;
END_WHILE;
Classification Data type
<initial_value>, <end_value>,
and <increment/decrement>*
Condition
expression
TRUE
Statement
FALSE
Repeated
End