Hacker News new | ask | show | jobs
by nj5rq 732 days ago
I feel like single-line conditionals are harder to read in bigger projects. I remove the brackets in single-statement conditionals and loops, but I still use another line.
1 comments

Braces _always_.

It just needs one tired / inexperienced / somethingelse coder to "quickly add" an extra call to the topmost if and then you'll have interesting issues.

I'll take the "ugly" braces every day compared to having risky structures like that in the code at all.

Thorough testing should catch all those "interestig" issues.

But easier maintainability I also favor braces everywhere.