DEV Community

loading...

Discussion on: A Case Against Switches

Collapse
darkain profile image
Vincent Milum Jr

Some language implementations have a limit to the number of "else if" statements you're allowed to use though.

Collapse
codevault profile image
Sergiu Mureşan

Interesting. I never knew that. What languages have this limitation?

Thread Thread
darkain profile image
Vincent Milum Jr

It isn't language specific, it is implemention specific. I know some C/C++ compilers have this issue, but not all.

Thread Thread
codevault profile image
Sergiu Mureşan

For embedded I can see that limitation and that switch could look much more readable since you're mostly working with numbers (integers, addresses etc.) instead of more complex structures (objects, strings etc.)