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

The if...else...if statement

We can also create a multilevel if...else...if statement using multiple if...else statements. Its syntax is as follows:

if ( conditional-expression )

action1

else if ( conditional-expression)

action2

else if ( conditional-expression)

action3

In  multilevel if...else...if statement, multiple conditional expressions are used to test whether one of several possible expression is true or not as shown in Figure 7.3.

Figure 7.3: An if...else...if statement flowchart

Let's understand the working of if...else...if with some examples. Simplest of all conditional expression to test is if a value is equal to the value stored ...

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