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

Break usage

The break statement is used to terminate the innermost while, do...while, or for loop that encloses it. The break statement is also used to break out of switch statement. It is meaningful if used inside a loop or with  a switch statement because, outside the body of a loop or switch, it has no meaning. All loop constructs have their termination conditional-expression, however sometimes it is possible that you achieve your goal before all iterations have been executed. In such cases break statement is used. Use of the break statement with while loop is illustrated in Figure 7.8:

Figure 7.8: A while loop flowchart with break statement ...

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