Updated note on line 30 (#31938)
Emphasized the note on line 30 and clarified that cases aren't just number values.
This commit is contained in:
committed by
The Coding Aviator
parent
59f2240274
commit
467fd189eb
@ -27,7 +27,7 @@ The above snippet shows the syntax for a basic `switch` statement. In this examp
|
|||||||
The `default` condition is a condition that will be executed if none of the other cases are true.
|
The `default` condition is a condition that will be executed if none of the other cases are true.
|
||||||
|
|
||||||
|
|
||||||
Note: One really important point to note here is that in the snippet above, `case 1:` and `case 2:` might seem to represent some kind of order, but `1` and `2` are nothing but the answers which the `(expression)` may get evaluated to. So therefore instead of 1 and 2 it can be anything which the `(expression)` may evaluate to and can be tested against.
|
**Note: One really important point is that in the snippet above, `case 1:` and `case 2:` might seem to represent some kind of order, but `1` and `2` are just possible answers which the `(expression)` may be evaluated to. The cases can be anything which the `(expression)` may evaluate to and can be tested against. A case may be a number, string, boolean, etc.**
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
```javascript
|
```javascript
|
||||||
|
Reference in New Issue
Block a user