Do / Loop                                                                                              Statement

 

DO

DO UNTIL expression

DO WHILE expression

 

Description

Repeats execution of the statements between the DO statement and the LOOP statement until an EXIT DO statement is executed, the expression in the DO WHILE  is false or the expression in the DO UNTIL  is true.

 

Example

i=0

Do

  i=i +1

    if i=5 then

    Exit Do

  End if

  ..............

  .............

Loop

 

'An equivalent  is

i=0

Do Until i=5

  i=i+1

  ...........

  ...........

Loop

 

'An equivalent  is

  i=0

  Do While i < 5

  i=i+1

  ............

  .............

Loop