2 ms·
if (test) { body; } if (... So, 5 lines each. Not 6. I miscounted. if (test1) body1; if (test2) body2; if (test3) body3;
by corysama 12y ago
if (test)
{
body;
}
if (...
So, 5 lines each. Not 6. I miscounted.
if (test1) body1;
if (test2) body2;
if (test3) body3;
if (test4) body4;
if (test5) body2;
Between the two formats, I greatly prefer the second. It is understandable at a glance and makes the possible error in the last line stand out much more. In practice, I usually encounter the first style -even in cases as trivial as single-function-call-per-if.