Scala uses the "Either" construct -- a disjoint union -- to return sucess or failure from a method call, like this:
def f(i:Int) =
if(i == 0)
Left("Divide by zero")
else
Right(24/i)
A newer version of Scala clarifies this idea by using "Try" to produce "Success" or "Failure" objects.
Is there anything like this in Kotlin, or is there another approach?
Thanks.