Skip to content

Instantly share code, notes, and snippets.

@kennetpostigo
Created June 24, 2018 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kennetpostigo/4acc0cfcc98343975af34ca5c897c2e1 to your computer and use it in GitHub Desktop.
Save kennetpostigo/4acc0cfcc98343975af34ca5c897c2e1 to your computer and use it in GitHub Desktop.
Reason BST Blog Post pattern matching syntax
/* Typical pattern matching with a switch */
switch (expression) {
| pattern1 => expression1
| pattern2 => expression2
| ...
| patternN => expressionN
};
/* Typical destructuring for tuple*/
let (x, y) = tupleOfXY;
/* Typical destructuring for records*/
let { name, age } = myDogBuddy;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment