Programming Tip #6: Pattern Matching

Jesse Warden - May 4 '22 - - Dev Community

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.

Image description

Learn More:

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .