else
and else if
are on the same line with the ending brace and opening brace, separated by a space:
if (condition1) { statement1; } else if (condition2) { statement2; } else { statement3; }
switch
statement, case
is indented one level, and the body of each case
is indented by another level. The opening brace is on the same line as switch
.
switch (expression) { case 0: command1; break; case 1: command2; break; default: command3; }