Skip to content

Instantly share code, notes, and snippets.

@kings13y
Created March 22, 2011 22:41
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 kings13y/882249 to your computer and use it in GitHub Desktop.
Save kings13y/882249 to your computer and use it in GitHub Desktop.
Simple Constructor Pattern Match example
case class Person(firstname: String, surname: String)
val p = Person("K", "D");
p match {
case Person("A", _) => "Person A"
case Person("K", _) => "Person K"
case _ => "missing person"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment