![Omron CS1-H Series Скачать руководство пользователя страница 169](http://html1.mh-extra.com/html/omron/cs1-h-series/cs1-h-series_operation-manual_742526169.webp)
154
Structured Text (ST Language) Specifications
Appendix B
Usage
Use the REPEAT statement to repeat processing for as long as a condition is met after specified processing,
when the number of iterations is undetermined beforehand (depends on whether the condition is met). This
statement can be used to determine whether to repeat processing according to the results of specified pro-
cessing execution (post-test loop).
Description
The
expression
will execute the first time without a condition. Thereafter, the
condition
equation will be evalu-
ated. If the
condition
is false
,
the
expression
will be executed again. If the
condition
is true, processing will end
without executing the
expression.
Precautions
• REPEAT must be used together with END_REPEAT.
• Even if the
condition
equation is true before the
expression
has been executed, the
expression
will be exe-
cuted.
• Statements that can be used in the
expression
are assignment statements, IF, CASE, FOR, WHILE, or
REPEAT.
• Multiple statements can be executed in the
expression
. Be sure to use a semicolon (;) delimiter between
multiple statements in an
expression
.
• The
condition
can also be specified as a boolean variable (BOOL data type) only rather than an equation.
Examples
Example 1: Numeric values from 1 through 10 are incremented and the total is substituted for the variable
TOTAL.
A:=1;
TOTAL:=0;
REPEAT
TOTAL:=TOTAL+A;
A:=A+1;
UNTIL A>10
END_REPEAT;
EXIT Statement
Summary
This statement is used within iteration statements (FOR, WHILE, REPEAT) only to force an iteration statement
to end. This statement can also be used within an IF statement to force an iteration statement to end when a
specified condition is met.
Reserved Words
EXIT
Statement Syntax (Example: Using within IF Statement)
FOR (WHILE, REPEAT)
expression
...
IF
<
condition
>
THEN EXIT;
END_IF;
...
END_FOR (WHILE, REPEAT);
Usage
Use the EXIT statement to force iteration processing to end before the end condition is met.
Description (Example: Using within IF Statement)
When the
condition
equation is true, the iteration statement (FOR, WHILE, REPEAT) is forced to end, and any
statements after EXIT will not be executed.
Содержание CS1-H Series
Страница 3: ...iv...
Страница 5: ...vi...
Страница 7: ...viii TABLE OF CONTENTS...
Страница 15: ...xvi Application Precautions 4...
Страница 151: ...136 Procedures Section 3 2...
Страница 153: ...138 Data Types Appendix A...
Страница 177: ...162 External Variables Appendix C...
Страница 181: ...166 Revision History...