Difference if..else n switch.

Q1. How is the if..else if combination more general than a switch statement?


Q1. Difference between if..else if combination and a switch statement?

Ans. The switch statement must be controlled by a single integer control variable, and each case section must correspond to a single constant value for the variable.

The if.. else if combination allows any kind of condition after each if.  


Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: