getOrElse
Get the right value B of this Either, or compute a default value with the left value A.
import arrow.core.Either
import arrow.core.getOrElse
import io.kotest.matchers.shouldBe
fun test() {
Either.Left(12).getOrElse { it + 5 } shouldBe 17
}Content copied to clipboard
Returns the option's value if the option is nonempty, otherwise return the result of evaluating default.
Parameters
default
the default expression.
Return the Valid value, or the default if Invalid