4 ms·
For many years I stopped using this after getting flack in pull requests. I’ve recently added it back into my toolkit and am reminded how much I love it. Don’t
by encoderer 6y ago
For many years I stopped using this after getting flack in pull requests.
I’ve recently added it back into my toolkit and am reminded how much I love it. Don’t over use it but there are some really gnarly if/else blocks that can be expressed beautifully with a switch and fall-thru.
- jbverschoor 6y agoIf (x) throw y; If (s) throw t; Throw default;
- encoderer 6y agoNope. Not the same. That is a switch with a break.
- jbverschoor 6y agoThe example in the post uses return and throw. Break doesn't matter in that case
- encoderer 6y agoI am not the author of the post. My comment specifically mentions fall thru.