switch case statement in typescript code example
Example 1: typescript switch test per case
switch(true) {
case if(constant1 == 1): {
//statements;
break;
}
case if(constant2 == 2): {
//statements;
break;
}
default: {
//statements;
break;
}
}
Example 2: ts switch
switch(expression) {
case constant-expression1: {
//statements;
break;
}
case constant_expression2: {
//statements;
break;
}
default: {
//statements;
break;
}
}