Question:When is a “switch” statement preferable over an “if” statement?
Answer The switch statement is best used when dealing with selections based on a single variable or expression. However, switch statements can only evaluate integer and character data types.
+ Report
When is a “switch” statement preferable over an “if” statement?