Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. import scala.util.Try
  2. // Try is not imported by default
  3. val t1: Try[String] = Try("hello")
  4. // t1: scala.util.Try[String] = Success(hello)
  5. val t2 = Try(throw new Exception("let's fail instead"))
  6. // t2: scala.util.Try[Nothing] = Failure(java.lang.Exception: let's fail instead)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement