This article covers the code generation for if-else and switch statements.
The code generated for a switch statement varies a lot from one compiler to another. In fact, a given compiler might generate different code in different scenarios. The choice of the code to be generated depends upon the number and range spread of individual case statements.
Different cases of generation of a switch statement are: