You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For control statements, why do you prefer elses to be on the same line as the if ending brace? 16.2
Under 8.3 - wrapping parens, you state that wrapping parens shows clearly where the function starts and ends.
I think that having the else block start on the same line is less clear than if it starts on a separate line. This is especially the case if the code blocks are small. You might read the if and skip over else entirely.
Currently preferred - same line
if (test) {
thing1();
} else {
thing2();
}
vs
Separate lines
if (test) {
thing1();
}
else {
thing2();
}
The text was updated successfully, but these errors were encountered:
For control statements, why do you prefer
else
s to be on the same line as the if ending brace? 16.2Under 8.3 - wrapping parens, you state that wrapping parens shows clearly where the function starts and ends.
I think that having the
else
block start on the same line is less clear than if it starts on a separate line. This is especially the case if the code blocks are small. You might read theif
and skip overelse
entirely.Currently preferred - same line
vs
Separate lines
The text was updated successfully, but these errors were encountered: