| 40 columns | |
| >>> Empty block body. |
| while (true) {} |
| <<< |
| while (true) {} |
| >>> Semicolon body. |
| while (true); |
| <<< |
| while (true) ; |
| >>> Don't split at parentheses. |
| while (aLongConditionExpressionThatWraps) { |
| ; |
| } |
| <<< |
| while (aLongConditionExpressionThatWraps) { |
| ; |
| } |
| >>> Split inside condition. |
| while (aLongCondition + expressionThatWraps) { |
| ; |
| } |
| <<< |
| while (aLongCondition + |
| expressionThatWraps) { |
| ; |
| } |
| >>> Block format condition expressions that allow it. |
| while (function(argument, argument, argument)) { |
| ; |
| } |
| <<< |
| while (function( |
| argument, |
| argument, |
| argument, |
| )) { |
| ; |
| } |
| >>> Unbraced body. |
| while (condition) something(i); |
| <<< |
| while (condition) something(i); |
| >>> Split unbraced body. |
| ### This goes against the style guide, but the formatter still has to handle it. |
| while (condition) someLong(argument, another); |
| <<< |
| while (condition) |
| someLong(argument, another); |
| >>> Split in condition forces split before body. |
| while (veryLongCondition || veryLongExpression) body; |
| <<< |
| while (veryLongCondition || |
| veryLongExpression) |
| body; |
| >>> Split in body forces split before body. |
| while (condition) veryLongExpression + anotherLongExpression; |
| <<< |
| while (condition) |
| veryLongExpression + |
| anotherLongExpression; |