I'd say always use brackets and on new lines, you never know when you want to extend an if or else clause in the future with additional code. If it is a simple statement use a ternary operator for it, if you really wanna keep it on one line.My method is similar to the one CornStalks mentioned, with minor differences.
For simple single-line statements, I'd go without brackets:But if they are chained ('else-if' or 'else'), I make the entire chain use brackets:if(...) //simple single-line statement if(...) //simple single-line statement
If an 'if' is stand-alone, but is multi-lined, or even single-lined but cluttered, I'll fully brace it.if(...) { //...more complex statements.... } else if(...) { //...more complex statements.... }
Or, even if the statement itself is simple, but the conditional is more complex, I'd brace it.if(x == foo && y == (N - 7) || z == PI) { //Fully braced, because of non-simple conditional. }
Btw here is the insomniac coding guide line and this is or something very similar (mostly comes down to camel casing on members and local variable declarations that's different) is used in a few places: http://www.insomniacgames.com/core-coding-standard/