3 ms·
I use it because if your switch is exhaustive, it's nice that the compiler can tell you exactly which parts of your code need to be updated when you add cases t
by archagon 9y ago
I use it because if your switch is exhaustive, it's nice that the compiler can tell you exactly which parts of your code need to be updated when you add cases to an enum. (Also, in Swift, fallthrough is opt-in instead of opt-out, which is great.)
- paulddraper 9y agoScala pattern matching is the same. Both are less easy to misuse than C switch.