Why do we switch case?

The main reasons for using a switch include improving clarity , by reducing otherwise repetitive coding, and (if the heuristics permit) also offering the potential for faster execution through easier compiler optimization in many cases.

Read more