Using the braces is technically "unnecessary" and just fills the code with meaningless empty space. (Empty space in code is very important, but only where it is meaningful)
I use a simple rule. If any statement contains a child scope (if, while, for, etc) then I omit the curly braces only if the statement and its child occupy one line each. (Bearing in mind that I also use a maximum of one statement per line)
That is,
if (condition)
return; -- "if" and child scope are 1 line each, no braces
and:
if (condition1 ||
condition2) -- "if" occupies more than 1 line, so use braces
{
return;
}
if (condition)
{
value = 1; -- child scope contains more than 1 line, so use braces
return;
}
if (condition)
{
// We will return now -- A comment is still a line, so use braces
return;
}
This applies regardless of what the lines are (comments, code, etc). That makes the rule very simple to apply, which eliminates any chance of making mistakes.
Note that it is generally recommended that we place the braces at the same indent level, as that symmetry (and the indent) provide a visual confirmation that the code is correctly formed. i.e. You can see that the "shape" of the code is correct, without having to actually read it, so any errors stick out like a sore thumb. By placing the open brace on the end of the if statement, there is no visual symmetry and you have to actually read the code to be sure that the scope is correctly formed.
I've not had a scoping error in over 20 years of programming (C, Java, C++, C#) using these rules.