February 2014
Beginner
1248 pages
62h 25m
English
If no match occurs between the controlling expression’s value and a case label, the default case (lines 52–54) executes. We use the default case in this example to process all controlling-expression values that are less than 6—that is, all failing grades. If no match occurs and the switch does not contain a default case, program control simply continues with the first statement after the switch.
Error-Prevention Tip 5.7
In a switch statement, ensure that you test for all possible values of the controlling expression.
Read now
Unlock full access