3 ms·
I've started to remove them from my own code. It's widely mentioned as The Right Way, but I feel the reasons why are obsolete. The stated reason is always that
by lucumo 4y ago
I've started to remove them from my own code. It's widely mentioned as The Right Way, but I feel the reasons why are obsolete. The stated reason is always that you could forget to add braces when adding a second statement.
That was useful in a time where a text editor was "smart" when it copied your indentation to a new line. But nowadays any tooling will warn you when indentation doesn't match the bracing. The odds of people making that mistake has gone so far down, that the risk is no longer worth the reduced readability.
- googlryas 4y agoYou don't know what tooling anyone editing your code is using though.
- Thiez 4y agoIf you enforce correct formatting before commits or in your CI builds that is no longer a problem.
- kwhitefoot 4y agoThat's a big if though.