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 SYSMAC CX-Programmer 9
Page 2: ......
Page 4: ...iv ...
Page 6: ...vi ...
Page 8: ......
Page 16: ...xvi ...
Page 20: ...xx ...
Page 26: ...xxvi Application Precautions 4 ...
Page 27: ...Part 1 Function Blocks ...
Page 28: ......
Page 154: ...128 Procedures Section 3 2 ...
Page 155: ...Part 2 Structured Text ST ...
Page 156: ......
Page 160: ...134 CX Programmer Specifications Section 4 2 ...
Page 206: ...180 Procedures Section 6 1 ...
Page 208: ...182 System defined external variables supported in function blocks Appendix A ...
Page 230: ...204 Revision History ...
Page 231: ......