If the statement must be broken in the middle of a parenthesized expression, such as for compound statements, or for the parameter list in a method invocation or declaration, the next line should be indented one level. For such statements, the curly opening brace should appear by itself on a new line.
Examples:
if (long_logical_test_1 ||
long_logical_test_2 ||
long_logical_test_3)
{
statements;
}
function(long_expression1,
long_expression2,
long_expression3,
long_expression4,
long_expression5,
long_expression6
);
A continuation line should never start with a binary operator. Never break a line where normally no white space appears, such as between a method name and its opening parenthesis, or between an array name and its opening square bracket. Examples:
// WRONG
while (long_expression1 || long_expression2
|| long_expression3)
{
}
// RIGHT
while (long_expression1 || long_expression2 ||
long_expression3)
{
}