158
Statement Descriptions
Section 5-5
Example 2: While X<3000, the value of X is doubled, and the value is substi-
tuted 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
■
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 processing execution (post-test loop).
■
Description
The
expression
will execute the first time without a condition. Thereafter, the
condition
equation will be evaluated. If the
condition
is false
,
the
expression
will be executed again. If the
condition
is true, processing will end without exe-
cuting the
expression.
■
Precautions
• REPEAT must be used together with END_REPEAT.
• Even if the
condition
equation is true before the
expression
has been exe-
cuted, the
expression
will be executed.
Expression
False
Iteration
True
End
Condition
Summary of Contents for CX-PROGRAMMER V8.1
Page 3: ...iv...
Page 5: ...vi...
Page 7: ......
Page 15: ...xvi...
Page 19: ...xx...
Page 25: ...xxvi Application Precautions 4...
Page 26: ...Part 1 Function Blocks...
Page 27: ......
Page 153: ...128 Procedures Section 3 2...
Page 154: ...Part 2 Structured Text ST...
Page 155: ......
Page 159: ...134 CX Programmer Specifications Section 4 2...
Page 205: ...180 Procedures Section 6 1...
Page 207: ...182 System defined external variables supported in function blocks Appendix A...
Page 229: ...204 Revision History...
Page 230: ......