0
Compare the if statement and switch statement .
2 ответов
+ 2
In addition to the other answer, you can have complex if conditions (e.g. checking multiple variables), but a switch limits you to the domain of the type you're switching on.
+ 1
The switch statement in essence is a more consice and readable way to define multiple if-else blocks