what is the diffrence between if-elseif-else and nested if stament in aso.net?which one is more appropriate in c£ applicatins and why
what is the diffrence between if-elseif-else and nested if stament in aso.net?which one is more appropriate in c£ applicatins and why
else if Statement
Multiple else if statements can be used after an if statement. It will only be executed when the if condition evaluates to false. So, either if or one of the else if statements can be executed, but not both.
Syntax:
if(condition1)
{
// code block to be executed when if condition1 evaluates to true
}
else if(condition2)
{
// code block to be executed when
// condition1 evaluates to flase
// condition2 evaluates to true
}
else if(condition3)
{
// code block to be executed when
// condition1 evaluates to flase
// condition2 evaluates to false
// condition3 evaluates to true
}
Step by step
Solved in 2 steps