Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#CCCCFF
int card=11;
int value;

/* Case 11,12,13 fall through to the same case */
switch (card) {
  /* ...MSC13-J:EX2: these three cases are treated identically  */
  case 11: 
  case 12: 
  case 13: 
    value=10; 
  break;
  default: 
    /* Handle Error Condition */ 
}

EX3: A case block needs no break statement if its last statement is return or throw.

Risk Assessment

Failure to include break statements leads to unexpected control flow.

...