One line 'if' or loop statements with or withour curly brace.
It's a good practice to put a curly brace after if or loop statement even if it's just one-liner.
Consider this statement:
Code:
if (condition)
doSomething();
it would work, but it is error-prone because if you try to add new statement inside inside if block:
Code:
if (condition)
doSomething();
doSomething2(); // Wrong! this will evaluated outside if statement
Also, without curly brace it's very difficult to read if you nested ifs:
Code:
if (condition)
if (anotherCondition)
doSomething();
else
doSomethingElse();
Now, which 'if' does the 'else' belong to?