DEV Community

Discussion on: ✔||🤢 Commit or Vomit | Switch(true)

edave64 profile image

This code definitely smells. So you have multiple conditions that are all mutually exclusive, but not similar enough that you can't just use a regular switch?

In any case, that's not what switch is for. If-else that stuff. Or, even better in this case, just if's because return ends control flow anyways.