3 ms·
You don't need braces around single-statement if/else/for blocks either, but you put them anyway because you're a good boy. Same could be argued for single-ar
by leppr 9y ago
You don't need braces around single-statement if/else/for blocks either, but you put them anyway because you're a good boy.
Same could be argued for single-argument arrow functions. My point being, this is a debatable point.
- ge96 9y agoAnd here I thought that was language specific like how Python from what I experienced did not use semi-colons to end statements. What about an if statement checking if something is true, is it enough to just say: if (value) { // true } I have seen some shortened code that I did not write and wasn't sure it was valid but it works.
- deleted 9y ago[deleted]
- TeMPOraL 9y agoReminds me of lambdas in Java 8. It's technically allowed to omit parenthesis for single-parameter lambdas (and tools like SonarQube encourage it), but I never do that, for the sake of consistency and readability.