11 repeat loop, 12 exit instruction, Repeat loop – Lenze DDS v2.3 User Manual

Page 48: Exit instruction, Drive plc developer studio

Advertising
background image

Drive PLC Developer Studio

Programming languages

4-10

l

DDS EN 2.3

4.3.11

REPEAT loop

The REPEAT loop differs from the WHILE loop in that the cancel condition will only be checked after
the loop has been carried out. This means that the loop must be executed at least once no matter
what the cancel condition is.

Syntax:

REPEAT
<instructions>
UNTIL

<Boolean expression>

END_REPEAT

;

The <instructions> are executed until <Boolean expression> returns TRUE.

If <Boolean expression> returns TRUE on first evaluation already, the
<instructions>

will be executed exactly once.

If <Boolean_expression> is never TRUE, the <instructions> will be repeated
endlessly, forcing a runtime error.

Example:

REPEAT
Var1:=Var1*2;

Counter:=Counter-1;
UNTIL
Counter=0

END_REPEAT

;

4.3.12

EXIT instruction

If the EXIT instruction is part of a FOR-, WHILE or REPEAT loop, the loop will be terminated
irrespective of the cancel condition.

In nested loops, EXIT terminates the innermost loop.

Show/Hide Bookmarks

Advertising