Last active
November 22, 2018 23:05
-
-
Save souhe/311ce474159e08f631c6bba13f5b717e to your computer and use it in GitHub Desktop.
This file contains 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
switch (userWithReview) { | |
| { name: "Maja", phone: "123123", review: Neutral, age: 24 } => | |
"Here we match every value with name Maja, phone 123123 Neutral review and age 24" | |
| { name: "Maja", phone } => | |
"Here we match every value with name Maja and we can use phone like a normal variable - " ++ phone | |
| { name, phone, review: Awesome} => | |
"Here we match every user with review Awesome and we can use phone and name" | |
| { name, phone, review: Bad(explanation)} => | |
"Here we match every user with review Baw and we can use phone, name, and the explanation" | |
| _ => | |
"Here we match everything else" | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment