DEV Community

cisneros-a
cisneros-a

Posted on

Readability vs Fewer Lines of Code

This is a trade off that I've struggled with. Some ways you might be able to see this in my code is seeing a mixture of single line conditional statements such as,

if (condition is met) return something

multiple line if statements with curly braces, such as

if (condition is met) {
return something
}

and an even shorter conditional

conditionToMeet && return something

.
They all do the same thing, however I feel I must be consistent with the way I implement my conditionals. And the difference is when you need to add an else statement. I just don't like having multiple different ways. I'm not sure. This is something I have to think about more.

Top comments (0)