WHILE   DO   END_WHILE

Statement - Repeat a list of statements.

Syntax

    WHILE <BOOL expression> DO
        <statements>
    END_WHILE ;

Remarks

The statements between "DO" and "END_WHILE" are executed while the Boolean expression is TRUE. The condition is evaluated beforethe statements are executed. If the condition is FALSE when WHILE is first reached, statements are never executed.


  • Loop instructions can lead to infinite loops that block the target cycle. Never test the state of an input in the condition as the input will not be refreshed before the next cycle.

ST Language

iPos := 0;
WHILE iPos < iMax DO
   MyArray[iPos] := 0;
   iNbCleared := iNbCleared + 1;
END_WHILE;

FBD Language

Not available

FFLD Language

Not available

IL Language

Not available

See also

IF   REPEAT   FOR   CASE    EXIT