The variable i is being switched upon. It is compared with each case. If a match is found, the statements after the matching case are executed. If no match is found, the default case is executed.
The break keyword at the end of each case block is necessary to prevent "fallthrough", where after a match is found, the code would continue executing the statements in the following case blocks as well. If the break keyword is omitted, ensure that is the desired behavior.
|
}
|