Created
April 21, 2016 11:01
-
-
Save Krasnyanskiy/8ea6ad7597d2ce281556a512d10b18ca to your computer and use it in GitHub Desktop.
-scala: PF with closure
This file contains hidden or 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
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