while statements

 

VBA Code Protection > Supported VBA syntax by compiler > while statements

 

A while statement is used to repeat statements, while a control condition (expression) is evaluated as true. The control condition is evaluated before the statements. Hence, if the control condition is false at first iteration, the statement sequence is never executed. The while statement executes its constituent statement repeatedly, testing expression before each iteration. As long as expression returns True, execution continues.

 

Examples:

 

WHILE (Data[I] <> X)

 I = I + 1 

END WHILE

 

WHILE (I > 0)

  IF Odd(I) THEN Z = Z * X  

  X = Sqr(X)

END WHILE

 

loop statements

 

 


Copyright © 2021 G.D.G. Software