NXC
Version 1.2.1 r5
|
A switch statement executes one of several different code sections depending on the value of an expression.
One or more case labels precede each code section. Each case must be a constant and unique within the switch statement. The switch statement evaluates the expression, and then looks for a matching case label. It will execute any statements following the matching case until either a break statement or the end of the switch is reached. A single default label may also be used - it will match any value not already appearing in a case label. A switch statement uses the syntax shown below.
Additional information about the case and default labels and the break statement can be found below.
A typical switch statement might look like this:
NXC also supports using string types in the switch expression and constant strings in case labels.