next up previous
Next: method Up: C++ Previous: if() rule

switch/case

No space before first ``('', one space after ``)'' before ``{'', ``case'' moved for one space, code moved usually - 2 spaces. Comments about ``case'' in one line with it.

switch(statement) {

 case 1:  // case comment

    ...

   <code>

    ...

   break;

 case 2:  // case comment

    ...

   <code>

    ...

   break;

 default:  // default comment

    ...

   <code>

    ...

   break;

}



2005-07-21