While not technically incorrect, the omission of curly braces can be misleading, and may lead to the introduction of errors during maintenance.
if (condition) // Noncompliant executeSomething();
if (condition) { executeSomething(); }
When the body of an if
statement is a single return
, break
or continue
and is on the same
line.