11.14 do

do [ loopname <loopname> ]
 <code>
while <condition>

The do command executes a block of commands repeatedly, checking the condition given in the while clause at the end of each iteration. If the condition is true then the loop executes again. This is similar to a while loop, except that the contents of a do loop are always executed at least once. The following example prints the numbersĀ 1, 2 andĀ 3:

i=1
do
 {
  print i
  i = i + 1
 } while (i < 4)

Note that there must always be a newline following the opening brace after the do command, and the while clause must always be on the same line as the closing brace.