Why switch?
If you’re thinking, you’ll have realised that that last switch statement could have been written using a chained if-then-else statement! So, why bother with switch?
It’s really just a matter of taste and style. Sometimes, if there’s a lot of possibilities all hinging on the value in one variable, a switch statement better describes what’s going on.