What is the best way (concisest, clearest, idiomatic) to catch MatchError when assigning values ββusing pattern matching?
Example:
val a :: b :: Nil = List(1,2,3)
The best way I've found so far:
val a :: b :: Nil = try { val a1 :: b1 :: Nil = List(1,2,3) List(a1, b1) catch { case e:MatchError =>
Is there an idiomatic way to do this?
source share