While and Do Loops
The While and Do loops all have the standard syntax. The While keyword is used to continue looping as long as the condition evaluates to True. The While block is terminated with a Wend statement. The Do loops are terminated with a Loop statement. 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.
Crystal syntax uses parentheses to define the code block.
Code template for While … Do:
Code template for Do..While:
The next example takes an array of names (populated elsewhere in the program) and uses a While loop to combine the names into a single string.