Skip to content

Instantly share code, notes, and snippets.

@Krasnyanskiy
Created April 21, 2016 11:01
Show Gist options
  • Save Krasnyanskiy/8ea6ad7597d2ce281556a512d10b18ca to your computer and use it in GitHub Desktop.
Save Krasnyanskiy/8ea6ad7597d2ce281556a512d10b18ca to your computer and use it in GitHub Desktop.
-scala: PF with closure
val f: PartialFunction[Int, Boolean] = {
case 1 => true
case 2 => true
case 3 => true
}
println {
f.applyOrElse(7, (_: Int) => false)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment