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 before the statements are executed. If the condition is FALSE when WHILE is first reached, statements are never executed.

attentionAttention

Loop instructions may 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

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

FBD Language

Not available.

LD Language

Not available.

Fixed_Image See also

IF  REPEAT  FOR  CASE  EXIT


Created with the Personal Edition of HelpNDoc: Full-featured EBook editor