Documentation (c) 2006-2008 Hobby-Robotics, LLC


Do Loop statement

Do Loop executes repeatedly block of statements based on a Condition. Condition can be any expression that evaluates to Boolean value True of False. The Condition is specified following Until or While. If Until is used then Condition must evaluate to True before loop will terminate. If While is used then Condition must evaluate to False before loop will terminate. If there is no Condition then statements will be executed forever, infinite loop. If condition follows Do keyword then it is evaluated before any statement in the Do Loop block is executed. If Condition follows Loop keyword then it is evaluated after Do Loop block statements have been executed once. The optional Exit Do statement allows to exit the Do Loop block immediately

regardless of the condition, can be used to terminate infinite loops.

Do Loop form where Condition is evaluated first before any statements are executed.

Do [ Until | While ] Condition

...

[ Exit Do]

...

Loop

Do Loop form where Condition is evaluated after statements have been executed once.

Do

...

[ Exit Do]

...

Loop [ Until | While ] Condition

Infinite Do Loop form, statements are executed repeatedly.

Do

...

Loop

Infinite Do Loop form can be terminated with Exit Do.

Do

...

[ Exit Do]

...

Loop

Wikipedia: Infinite loop

Wikipedia: Condition-controlled loops