3 ms·
For bonus alignment points and malleability, start with 'true' and place the closing parenthesis on a new line: if (true && condition1 && c
by rzzzt 4y ago
For bonus alignment points and malleability, start with 'true' and place the closing parenthesis on a new line:
if (true
&& condition1
&& condition2
&& condition3
) {
...
}
If you ever need to change the set of conditions, the diff will cleanly add/remove whole lines.
- masklinn 4y agoOr borrow a page from the FP language folks, which gets most of the way there (prepending an items is still a -1+2 diff) without the weird initial clause: if ( condition1 && condition2 && condition3 ) { ... } Obviously the best alternative is to switch to a prefix language and sidestep the issue entirely: (when (and (condition1) (condition2) (condition3)) ...)