A switch here would be just fine since it just returns the result. However in a lot of situations when i'm considering switch cases I don't have to return the value evaluated from the case block which ultimately I'd become forced to put in a break which unnecessarily adds more lines than needed. In those situations it looks much nicer to just write if/else conditions while keeping the code short.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
A switch here would be just fine since it just returns the result. However in a lot of situations when i'm considering switch cases I don't have to return the value evaluated from the case block which ultimately I'd become forced to put in a
break
which unnecessarily adds more lines than needed. In those situations it looks much nicer to just write if/else conditions while keeping the code short.