C#

Simple IF

The if section of the statement or statement block is executed when the condition is true, if it is false, control executes the code in the else statement or statement block. ,The else portion of the statement is optional.,

 

If Else If

An if..else statement can have more if and else., The following code snippet uses an if.. and else if statement to check another condition., In this case; if the first if condition is not true; the program control goes to the next else..if condition and if this condition is not true also, then the control statement goes the last else part of the code.,

 

Else if

C sharp if else statement is a common selection statement., The if else in C sharp statement checks a Boolean expression and executes the code based on if the expression is true or false.,The if part of the code executes when the value of the expression is true.,The else part of the code is executed when the value of the expression is false.,The else part of the if..else is optional.,

 

Nested IF

C sharp supports if else statements inside another if else statements., This are called nested if else statements., The nested if statements make the code more readable., You can have nested if . . .else statements with one or more else blocks.,Nested if can be used in both the if and else parts of the statement.,The following code sample uses a nested if inside the else block.,You can use multiple nested if statements.,