Variants and Pattern Matching Variants using switch in Reason

InstructorNik Graf

Share this video with your friends

Send Tweet

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.