153
Structured Text (ST Language) Specifications
Appendix B
Precautions
• WHILE must be used in combination with END_WHILE.
• Before executing the
expression
, if the
condition
equation is false, the process will end without executing
the
expression.
• 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: The value exceeding 1000 in increments of 7 is calculated and substituted for variable A.
A:=0;
WHILE A>=1000 DO
A:=A+7;
END_WHILE;
Example 2: While X<3000, the value of X is doubled, and the value is substituted for the array variable DATA[1].
The value of X is then multiplied by 2 again, and the value is substituted for the array variable DATA[2]. This
process is repeated.
n:=1’
WHILE X<3000 DO
X:=X*2;
DATA[n]:=X;
n:=n+1;
END_WHIE;
REPEAT Statement
Summary
This statement is used to repeatedly execute an expression until a specified condition is true.
Reserved Words
REPEAT, UNTIL, END_REPEAT
Statement Syntax
REPEAT
<
expression
>
;
UNTIL
<
condition
>
END_REPEAT
Processing Flow Chart
Expression
False
Iteration
True
End
Condition
Содержание 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...