Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Variants and Pattern Matching Variants using switch in Reason


    Variants are known as tagged unions in Computer Science. They allow us to express multiple options that are exclusive, as a data structure. A concept that isn't available in too many programming languages and yet such a powerful concept.

    We explore how to create variants and constructors in ReasonML and briefly touch on how to pattern match them to extract data.