do...while loop statement

In the AWK while loop, the condition is checked at entry, so it is called an entry-controlled loop. The do...while loop is an exit-controlled loop; the condition is checked at exit time. The do...while loop always executes the body at least once and then repeats the body as long as the condition is true.

It differs from the while and for in a way; it tests the conditional-expressions at the bottom instead of the top, so it will always execute the body once, even if the condition evaluates to false as illustrated in Figure 7.6. Its syntax is as follows:

do

action statements

while ( conditional-expression )

Following figure 7.6 illustrates the working of a do-while loop statement in AWK programming:

Figure 7.6: ...

Get Learning AWK Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.