DEV Community

Discussion on: Why we shouldn't use "else"

Collapse
 
stevetaylor profile image
Steve Taylor

I wouldn’t religiously avoid else just because some people abuse it. That would make a lot of code significantly less expressive and result in unnecessary branch condition evaluations. A simple if-else, without else, would have two ifs evaluating the same expression, with the 2nd expression negated.