The Psychology of Quality and More |
CHAPTER 6 : Layout
6.12 'switch' statementsThere are a few variations on the layout for a switch statement, beyond the brace style discussed above:
switch ( WidgetStyle ) -------------------------------------------------- This 'toothbrush' style tends to tramp rapidly across to the right in the indenting of both the case and the code for each case starting on the same line as the case (particularly if the cases are long). These can be addressed with a 'comb' layout:
switch ( WidgetStyle )
Each case is now more in the style of an if statement, with the code for each case indented on the line following the decision. Starting the case in the same column as the switch is like matching an else with an if. It also saves horizontal space.
|
Site Menu |
Quality: | Quality Toolbook | Tools of the Trade | Improvement Encyclopedia | Quality Articles | Being Creative | Being Persuasive | |
And: | C Style (Book) | Stories | Articles | Bookstore | My Photos | About | Contact | |
Settings: | Computer layout | Mobile layout | Small font | Medium font | Large font | Translate | |
You can buy books here |
And the big |