What goes to default section of your code?

Sandeep Balachandran on June 10, 2019

Hey guys,
I just wonder what goes to default section of your switch statement or else part If – else – if ladder Statement . Is it the very last remaining option or an exception case besides the available options.

markdown guide

I usually prefer placing an exception there. In typescript i often add a assertUnreachable() method there that returns never. If an enum value goes unhandled, the compiler will give an error.

code of conduct - report abuse