O'Reilly logo

Learning AWK Programming by Shiwang Kalkhanda

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required