The Arduino Switch Case Reference has a switch structure written two different ways:
First in the Syntax as:
switch (var) {
case label1:
// statements
break;
case label2:
// statements
break;
default:
// statements
}
and then in the Example code as:
switch (var) {
case 1:
//do something when var equals 1
break;
case 2:
//do something when var equals 2
break;
default:
// if nothing else matches, do the default
// default is optional
break;
}
Is there any reason to (or not to) add a break; in the default: case? Does the need for 'break;' change if the final case is not default:?