http://www.jindent.com |
|
Next: Switch-Case Blocks |
Blank lines before statements containing blocks |
a = callMethod(); a++; ¶ if (a < 10) { ... } |
a = callMethod(); a++; if (a < 10) { ... } |
void method() { do { ... } while(x < n); ¶ a = callMethod(); a++; ¶ if (a < 10) { ... } ¶ callOtherMethod(); } |
Blank lines after statements containing blocks |
do { ... } while(x < n); ¶ a = callMethod(); a++; |
do { ... } while(x < n); a = callMethod(); a++; |
void method() { do { ... } while(x < n); ¶ a = callMethod(); a++; ¶ if (a < 10) { ... } ¶ callOtherMethod(); } |
Insert blank lines between different statement types |
void main() { cout << "Hello World !"; // cout callMethod(); // method call a = getSomething(); // assingment b = a + 1; // assingment callAnotherMethod(a, b); // method call callEvenMoreMethods(); // method call a++; // expression ... } |
void main() { cout << "Hello World !"; // cout ¶ callMethod(); // method call ¶ a = getSomething(); // assingment b = a + 1; // assingment ¶ callAnotherMethod(a, b); // method call callEvenMoreMethods(); // method call ¶ a++; // expression ... } |
Blank lines before break statement |
break
statements.
switch(value) { case 1: x = x + 10; y = x / 2; ¶ break; ¶ ... } |
switch(value) { case 1: x = x + 10; y = x / 2; break; ¶ ... } |
Blank lines before continue statement |
continue
statements.
if ( condition ) { x = x + 10; y = y / 2; ¶ continue; } |
if ( condition ) { x = x + 10; y = y / 2; continue; } |
Blank lines before return statement |
return
statements.
int getA() { int x = callMethod(); x = x + 10; ¶ return x; } |
int getA() { int x = callMethod(); x = x + 10; return x; } |
Blank lines before throw statement |
throw
statements.
if ( x == null ) { text = createErrorText(); ¶ throw text; } |
if ( x == null ) { text = createErrorText(); throw text; } |
Blank lines before goto statement |
goto
statements.
if ( x == null ) { text = createErrorText(); ¶ throw text; } |
if ( x == null ) { text = createErrorText(); throw text; } |