I have a method
def foo(num: Int): String
Where I call some in some places in my code, and everything was good.
Lately, I encountered
Since the result space is cleanly split into two sides (disjointed) consider Either like so
def foo(i: Int): Either[(String, String), String] =
if (i == 10) Left("one", "two") else Right("one")
val Left(Tuple2(x, y)) = foo(10)
val Right(a) = foo(2)
which is inspired by @Krzysztof's edit regarding "special container".