Nested if-else statements and switch statements both allow for multi-way selection. When would it not be advisable to use a switch statement?
The expression used in the switch must be integral type (int, char and enum). Any other type of expression is not allowed. So, when we want to use non-integral type data then we should go for nested if else.
Also, the switch is based on the value of a variable. If switch is based on a complex AND/OR/NOT boolean expression that varies for each condition, then we should go for nested if else.
PLEASE LIKE THE SOLUTION :))
IF YOU HAVE ANY DOUBTS PLEASE MENTION IN THE COMMENT
Get Answers For Free
Most questions answered within 1 hours.