by TrianguloY · 3y ago · 0 comments
result = a==1
|| b==2
|| c==3
;
Vs result = a==1 ||
b==2 ||
c==3 ;
and result = data
.getA()
.getB()
.getC()
;
Vs result = data.
getA().
getB().
getC();
Personally I prefer the first examples, because for me it's easier to "group" the lines. foo = here_is_some_logical_condition ||
and_another ||
(this_term && that_term) ||
exception_case;
vs foo = here_is_some_logical_condition
|| and_another
|| (this_term && that_term)
|| exception_case;Records: https://github.com/janestreet/base/blob/master/src/avltree.m...
If statements: https://github.com/janestreet/base/blob/master/src/string.ml...
Lists: https://github.com/janestreet/base/blob/master/src/string.ml...
Function calls: https://github.com/janestreet/base/blob/master/src/string.ml...
Type definitions: https://github.com/janestreet/base/blob/master/src/array.ml#...
It's not always used, shorter snippets tend to be all on one line.