You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 3, 2021. It is now read-only.
var patternMatch = fun(x) {
return match (x) {
case { name, "location": "Eindhoven" }: {
return name + " lives in Eindhoven"
}
case { name, location }: {
return name + " doesn't live in Eindhoven but in " + location
}
case default: {
return "I don't know where " + x.name + " lives"
}
}
}
patternMatch({ "name": "Kane", "location": "Uden" }) // "Kane doesn't live in Eindhoven but in Uden"
patternMatch({ "name": "Jan", "location": "Eindhoven" }) // "Jan lives in Eindhoven"
patternMatch({ "name": "Emma" }) // "I don't know where Emma lives"