Question: what is the difference between switch and if statement?
Answer: The if statement is used to select among two alternatives. It uses a boolean expression to decide which of the alternative should be executed. The switch statement is used to select among multiple alternatives. It uses an expression to determine which alternative should be executed.