DEV Community

Discussion on: Why switch is better than if-else

Collapse
 
gklijs profile image
Gerard Klijs

Would it not be even cleaner to first get an enum from the expression (if it wasn't an enum already). And then call a function on the enum. It least I find it a lot easier to read, and anything specific to the enum is all together, instead of spread around.