3 ms·
What can switches finally do that when can't? Other than the terrible fall through behavior? When used as a different way of writing an if else if can be a cod
by Larrikin 10mo ago
What can switches finally do that when can't? Other than the terrible fall through behavior?
When used as a different way of writing an if else if can be a code smell. When used with an exhaustive list of an enum or sealed class prevents bugs in production.
- gf000 10mo agoSwitch expressions don't do fall through. They are proper ML-like pattern matching.