Repeat Instructions - JUMO LOGOSCREEN 601 Manual

Paperless recorder, st editor
Hide thumbs Also See for LOGOSCREEN 601:
Table of Contents

Advertisement

7.2

Repeat instructions

With repeat instructions (iterations), instructions and groups of instructions are executed repeatedly.
There are three types of repeat instructions:
FOR
WHILE
REPEAT UNTIL
FOR instruction
The FOR instruction is used if the number of repeats is fixed.
Keywords:
FOR, TO, BY, DO, END_FOR
Examples:
VAR
i: UINT;
j: UINT;
a: UINT;
b: UINT;
END_VAR
FOR i := 10 TO 100 BY 10 DO
j := j + i;
END_FOR;
(* i runs from 10 to 100 in steps of 10 (10, 20, 30, ..., 100)
FOR a := 1 TO 5 DO
b := b + a;
END_FOR;
(* if "BY x" is not specified, the control variable is increased by 1 in each cycle
(1, 2, 3, 4, 5) *)
WHILE instruction
The WHILE instruction causes a group of instructions to be repeatedly executed until the associated
Boolean expression is incorrect (FALSE, untrue). If the Boolean expression is incorrect from the begin-
ning, the group of instructions is not executed at all.
Keywords:
WHILE, DO, END_WHILE
Example:
WHILE j < 100 DO
j := j + 2;
END_WHILE;
7 Instructions
*)
33

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Logoscreen 700706521706530

Table of Contents