3 ms·
Whoever linebreaks return statements like that deserves what's coming to them. But I get what you're saying. Simple, consistent rules are better for teamwork.
by gcr 16y ago
Whoever linebreaks return statements like that deserves what's coming to them.
But I get what you're saying. Simple, consistent rules are better for teamwork.
- pdw 16y agoI do that sometimes (obviously not in JavaScript), to split up long lines in situations such as this: bool is_foo_possible() { return test_first_condition() && test_second_contition() && test_third_condition() } I don't think that's very horrible.
- BrandonM 16y agoI would tend to write that: bool is_foo_possible() { return test_first_condition() && test_second_contition() && test_third_condition() } I prefer to put my infix operators at the beginning of continuation lines, because that makes it immediately clear from a glance that it's a continuation line.
- IsaacSchlueter 16y agoI do this as well. For a while, I tried to stick to the rule that "return\n" was not allowed. When I meant to return undefined, I'd write "return undefined". In the end, I abandoned that rule, because too many of my functions return undefined. But it's kind of a nice thing. When I do get around to building that linter, I might make `return\s*\n` verboten.
- olavk 16y agoYou could just write "return;", that would make it obvious that no value is returned.
- gcr 16y agoOH. Good point.