switch
Multi-branch comparison.
Syntax
switch (value) { case x: ...; break; }Description
Don't forget to put break after each case (otherwise the following ones will also execute).
Example
Loading editor…
Expected output
Tue
When to use?
Menu, state control.