Case can only be constant (#30360)

case can be defined by a constant not by variable
pull/28675/head^2
Nikhat Zaidi 2019-01-29 21:40:02 +05:30 committed by Christopher McCormack
parent 4e2ff2b0bd
commit 48313a48a6
1 changed files with 2 additions and 0 deletions

View File

@ -10,6 +10,8 @@ It's a list of possibilities, with an action for each possibility, and an option
We exit from the switch by `break`. If the `break` statement is not reached before the beginning of the next case, the execution will fall through and begin executing the code in the next case, which means if you have no break statement in code, when first case is detected to be true, all the other cases below the one that is detected to be true (including itself) will be executed, which is often undesirable.
Each case must be a digit or a character i.e.. a constant but not a variable.
## Syntax of switch...case
```c