4 ms·
> What are you buying over a series of if-else statement Code clarity. Depending on how and what you're doing in each case a switch statement can be easier to
by mhurron 13y ago
> What are you buying over a series of if-else statement
Code clarity. Depending on how and what you're doing in each case a switch statement can be easier to read than a whole series of if .. else blocks.
And sometimes, given that they are equivalent, it's just a style choice on the part of the programmer.