let foo:uint32 = 10;
switch (foo)
{
case 10: // fine
break;
case `baz`: // TypeError unexpected string literal, expected uint32
break;
}
Most integral types have obvious switch behavior. Every floating point type though should be restricted as per convention with most every programming language.
let foo:float32 = 1.23;
switch (foo) // TypeError float32 cannot be used in the switch variable
{
}
Enumerations would be valid based on their assigned type.
Refer to:
Most integral types have obvious switch behavior. Every floating point type though should be restricted as per convention with most every programming language.
Enumerations would be valid based on their assigned type.