In if statement and switch case which is better and why?
Answers
Answered by
1
Explanation:
A switch statement is usually more efficient than a set of nested ifs. The compiler can do this because it knows that the case constants are all the same type and simply must be compared for equality with the switch expression, while in case of if expressions, the compiler has no such knowledge. .
Similar questions
Computer Science,
2 months ago
Geography,
3 months ago
Social Sciences,
3 months ago
Chemistry,
11 months ago
History,
11 months ago