Nested if else statement

Nested if else statement


Nested if is a conditional statement, which is used when more than one condition is required to be checked at the same time in a program. The statements are executed from the top to the bottom, checking each condition, whether it meets the criteria or not. If the condition is true, then it executes the block of associated statements of true part, else it goes to the next condition to execute.

Nesting an if means you can use one if or else if statement inside another if or else if statement. The inner if(s) must always be terminated before the outer if(s).