DEV Community

Discussion on: You don't always need “else” in your "if"

Collapse
guilhermetoti profile image
Guilherme Toti Author

Yeah, me too, for sure!
But the idea of this post was just to show that we don't need to always use else, that's why I didn't use the ternary operation there

Collapse
dpkahuja profile image
Deepak Ahuja 👨‍💻

Yes helpful because it reduced the code branch by 1 and also indentation is reduced. The read to write code ratio is like 10:1, hence it makes a big difference while reading code.