Nested if statement
Nested if statement is the next step of if-else statement. The nested if statement provides the facility to use a conditional if statement inside the another conditional if statement.
Let's see an appropriate example of nested if statement.
16
Sorry! you are not eligible
25
Congrats! you are eligible
if else-if ladder statement
The if else-if statement is used in that situation, when we want to execute different block code in different conditions. In this statement, there can be multiple block of code defined in the else-if statement and one block of code defined in the if statement.
The process starts by the checking of if block condition. If it is not true, then it will check the condition of else-if statement. If none of these condition is true, then in that situation else block code will be execute.
Here is the syntax of if else-if statement.