3 ms·
To if (cond) { or not to if( cond ){ That is the question. I agree that spacing matters a lot. Another interesting idea is that long lines are less rea
by jhrobert 16y ago
To
if (cond) {
or not to
if( cond ){
That is the question.
I agree that spacing matters a lot. Another interesting idea is that long lines are less readable and that whatever is at the end of a line is less readable than what is at the beginning.
To
a = something_long +
something_else
or not to
a = something_long
+ something_else
That is another question.
Style matters, develop your own.
- aerique 16y agoWith regard to your last example, I think the most important is to be consistent within a project where you put the '+'.
- niccl 16y agoIn the second example, I find it depends on the language. In general I prefer the top version, but in SQL and some other languages I will usually use the second. That's because I might well want to comment out part of the statement. For example: select col_1 -- , col_2 , col_3 from the_table ; With this approach (the OP's second approach), I can easily comment out a whole line and the rest of the statement will be syntactically correct. The alternative means having to chase around to find the trailing comma (or 'and', or whatever). But maybe it really only matters because of my recent 'suck it and see' approach to SQL, where I've been exploring an unknown database, trying to find the queries that work...