4 ms·
Personally I don't like switch statements at all, especially the ones that require manual control flow management. I can vividly remember multiple bugs over th
by cle 10y ago
Personally I don't like switch statements at all, especially the ones that require manual control flow management. I can vividly remember multiple bugs over the years caused by forgetting to add "break" to a switch statement.
Unless you're optimizing for performance (which is rare in my domain), control-flow statements are a smell and should be avoided. Each branch has some "implicit" state that is being fragmented and has to be manually managed by the programmer.