Always Use Curly Braces for Control Statements¶
All if
, for
, and while
statements should be enclosed in curly braces.
This will significantly improve the readability and maintainability of code.
Statements without curly braces can often cause confusion between what the compiler
is doing and what the author intended the code to do.
Even if the code currently seems clear, missing curly braces can invite edits which are ambiguous.