Like other programming languages, in C# also conditions may be checked within a condition, i.e. nested if-else allows us to check other conditions within if or else block.
Syntax:
    if(test_condition1){
	    //code section 1
	    if(test_condition_a){
		    //code section a
    }
    else{
	    //code section b
    }
    }
    else if(test_condition2){
    {
	    //code section 2
    }
    else if(test_condition3){
	    //code section 3
    }
    ...
    else{
	    //else code section
    }
See the syntax above, here we are checking test_condition_a within the test_conditon1 block, if test_condition1 will be true, "code section a" will be executed.
 
                                                                     
                            
C# example for nested if else statement
Here, we are asking for a character – and check whether it is vowel or consonant, if input character is a valid alphabet
Output
need an explanation for this answer? contact us directly to get an explanation for this answer