Created
June 24, 2018 14:33
-
-
Save kennetpostigo/4acc0cfcc98343975af34ca5c897c2e1 to your computer and use it in GitHub Desktop.
Reason BST Blog Post pattern matching syntax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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