Programming Tip #6: Pattern Matching. Using Variant/Union/Sum types, you can ensure ALL possibilities are handled. This solves bugs that switch statements have using defaults. For JavaScript, you can use the Folktale Union library. For Python v3.10's pattern matching, you can use Typings + mypy.
Learn More:
Top comments (0)