TypeScript Switch Statement
TypeScript switch statement executes one statement from multiple conditions. It evaluates an expression based on its value that could be boolean, number, byte, short, int, long, enum type, string, etc. A switch statement has one block of code corresponding to each value. When the match is found, the corresponding block will be executed. A switch statement is work like if-else-if ladder statement.
The following points must be remembered in a switch statement:
a+b is 5.
Example with String
Marks [ >= 80 and <90 ] Good
TypeScript Switch Statement is fall-through
The TypeScript switch statement is fall-through. It means if a break statement is not present, then it executes all statements after the first match case.
20 30 Not in 10, 20 or 30