Next: , Previous: If Statement, Up: Statements  7.4.2 The while
Statement        while (condition)  body is a statement called
the body of the loop, and condition is an expression that
controls how long the loop keeps running. The first thing the
while statement does is test the condition. If the condition is
true, it executes the statement body. After body has been
executed, condition is tested again, and if it is still true,
body is executed again. This process repeats until the condition
is no longer true. If the condition is initially false, the body
of the loop is never executed and awk continues with the
statement following the loop. This example prints the first
three fields of each record, one per line:       awk '{
i = 1             while (i <= 3) {                 print $i
}' inventory-shipped   A newline is not required between the
condition and the body; however using one makes the program
clearer unless the body is a compound statement or else is very
simple. The newline after th