Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import scala.util.Try
- // Try is not imported by default
- val t1: Try[String] = Try("hello")
- // t1: scala.util.Try[String] = Success(hello)
- val t2 = Try(throw new Exception("let's fail instead"))
- // t2: scala.util.Try[Nothing] = Failure(java.lang.Exception: let's fail instead)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement