While and Do Loops
The While and Do loops all follow the standard VB .NET syntax. The While block is terminated with a Wend statement. The Do loops are terminated with a Loop statement. The While keyword is used to continue looping as long as the condition evaluates to True. The Until keyword is used to continue looping when a condition evaluates to False. You can exit a Do loop with an Exit Do statement.
Code template for While … Wend:
While true_condition
...code...
Wend
Code template for Do While … Loop:
Do While true_condition
...code...
Loop
Code template for Do Until … Loop:
Do Until false_condition
...code...
Loop
Code template for Do … Loop While:
Do
...code...
Loop While true_condition
Code template for Do … Loop Until:
Do
...code...
Loop Until false_condition
Crystal syntax has few looping structures to choose from. It has the While..Do loop and the Do..While loop. It uses parentheses to define the code block.
Code template for While … Do:
While true_condition Do
(
...code...
)
Code template for Do..While:
Do
(
...code...
) While true_condition