5 ms·
The argument (which I agree with, although it can be a pain to adopt at first): http://wiki.c2.com/?AlwaysUseBracesOnIfThen http://wiki.c2.com/?AlwaysUseBraces
by yarrel 10y ago
The argument (which I agree with, although it can be a pain to adopt at first):
http://wiki.c2.com/?AlwaysUseBracesOnIfThen http://wiki.c2.com/?AlwaysUseBracesOnIfThen
- tekacs 10y agoWhat you linked is about braces around the /body/ of an if statement. What the GP poster was talking about was parentheses around the /conditions/ of an if statement. Note that Rust (for example) doesn't require the latter. In fact, if you always require braces (as in the post that you linked), then it's very easy to parse and read code which is lacking those parentheses on the condition. i.e. `if (condition) x = x + 1` would be hard to read without parens. but `if condition { x = x + 1 }` (with mandatory braces) is quite clear.
- weberc2 10y agoThe GP said brackets, not parens. Perhaps he misspoke?
- david-given 10y agoAh, yeah. I didn't twig until you mentioned it, but... if ever you get tired of emacs vs vi religious wars, try switching to discussing whether 'bracket' refers to a parenthesis or a brace. Given the context, I'm pretty sure the OP was using the 'parenthesis' meaning.
- zem 10y agoin commonwealth english, it's most commonly "brackets" for (), "square brackets" for [] and "curly brackets" for {}
- david-given 10y agoYeah, that's what I grew up with. Where is it otherwise? Is bracket={} a USism? I've never been sufficiently aware to isolate the demographic.
- whiteandnerdy 10y agoIn British English, 'brackets' means parentheses, as opposed to square brackets or curly brackets (also called braces). Maybe OP uses British English.
- marcoms 10y agoAs others speculated I meant parentheses around the condition - my mistake, I should have qualified