Skip to main content

2 docs tagged with "Code Style"

View All Tags

Always use a Brace

In C, C++, Java, and other languages, you use curley-braces — '\{' and '\}' — to indicate the start and the end of a block of code.  However, the braces are optional if the block is only a single line.  This is an option you should never use.  Always use the brace, even if it is a single line.

Avoid Deep Conditional Nesting

Simply put: try to make your conditions as flat as possible.  This makes them generally easier for the humans to parse and understand.