4.1.1 Braces are used for all control structures
Disallowed:
4.1.2 Nonempty blocks: K&R style
Braces follow the Kernighan and Ritchie style () fornonempty blocks and block-like constructs:
- Line break after the opening brace.
- Line break after the closing brace if that brace terminates a statement orthe body of a function or class statement, or a class method. Specifically,there is no line break after the brace if it is followed by
else
,catch
,while
, or a comma, semicolon, or right-parenthesis.
4.1.3 Empty blocks: may be concise
An empty block or block-like construct may be closed immediately after it isopened, with no characters, space, or line break in between (i.e. ),unless it is a part of a multi-block statement (one that directly containsmultiple blocks: if
/else
or try
//finally
).
Disallowed: