http://www.jindent.com |
|
Next: Empty Statements/Declarations |
Single if statement in one line |
if
statements which just contain a single statement instead
a block body.if
statement in one line:
if (a < 10) callMethod(a); |
if
statement in one line:
if (a < 10) callMethod(a); |
Single else statement in one line |
else
part of if-else
statements which just contain
a single statement instead a block body.else
statement in one line:
if (a < 10) callMethod(a) else callOtherMethod(a); |
else
statement in one line:
if (a < 10) callMethod(a) else callOtherMethod(a); |
if
and else
statement in one line:
if (a < 10) callMethod(a) else callOtherMethod(a); |
Treat else and if as one else/if statement |
else
and if
statements are put together as one statement or not.else
and if
statements as one statement:
if (a < 10) { cout << "a"; } else if (b < 10) { cout << "b"; } else if (c < 10) { cout << "c"; } else cout << "none"; |
else if
treatment:
if (a < 10) { cout << "a"; } else if (b < 10) { cout << "b"; } else if (c < 10) { cout << "c"; } else cout << "none"; |