Brace Placement

There are two major brace placement strategies that are acceptable:

  1. Place brace under and inline with keywords:

Good

  if (condition)
  {

  }
  1. Place the initial brace on the same line as the keyword and the trailing brace inline on its own line with the keyword:

Good

  if (condition) {

  }

You can choose either of the two strategies shown above. However, you should be consistent in using one strategy and not mix them together.

Bad

    if (condition)
        {

        }

Bad

    if (condition)
{

          }