if (true) { doSomething(); } else { doSomethingElse(); }
One last thing. On the C/C++ braces style. It has gotta be ‘Allman’ for me. It just looks so much more readable when there is symetry.
if (true) { doSomething(); } else { doSomethingElse(); }
One last thing. On the C/C++ braces style. It has gotta be ‘Allman’ for me. It just looks so much more readable when there is symetry.
I like that style to, although I prefer it without the empty lines.
The empty lines really aren’t there. For some reason the PRE tags are doing that.
IMHO, for big chunks of code:
if ( x == y ) { DoSomething(); } else if ( x == y ) { DoSomethingElse(); } else { }
( 2 spaces per indent, 1 space padding )
if ( x == y ) DoSomething(); else DoSomethingElse();
or
if ( x == y ) DoSomething(); else if ( x == y ) DoSomethingElse(); else if ( x == y ) DoSomethingElse(); else if ( x == y ) DoSomethingElse(); else if ( x == y ) DoSomethingElse(); else DoSomethingElse();
Is OK, as long as there is at least one empty line above and below.