Skip to content

Instantly share code, notes, and snippets.

@michalkowol
Last active August 29, 2015 14:10
Show Gist options
  • Select an option

  • Save michalkowol/e334f8bafff000e11549 to your computer and use it in GitHub Desktop.

Select an option

Save michalkowol/e334f8bafff000e11549 to your computer and use it in GitHub Desktop.
def pattern(value: String, consToMatch: String): String = {
val a = "1"
val b = "2"
value match {
case `a` => "one"
case `b` => "two"
case `consToMatch` => "!!!"
case _ => "???"
}
}
pattern("1", "3") // one
pattern("3", "3") // !!!
pattern("3", "xxx") // ???
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment