Created
October 14, 2014 10:50
-
-
Save loverdos/ac2c683f353da03e2a2d to your computer and use it in GitHub Desktop.
Enhanced Scala match with exception handling
This file contains 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
// Inspired by latest OCaml | |
eval() match { | |
case v1 => | |
case v2 => | |
case _ => | |
case catch e: Exception => | |
case catch _ => | |
case finally => | |
} | |
// or | |
eval() match { | |
case v1 => | |
case v2 => | |
case _ => | |
catch e: Exception => | |
catch _ => | |
finally => | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment