get Or Else
Returns the value from this Right or the given argument if this is a Left.
Example:
import arrow.core.Either.Right
import arrow.core.Either.Left
import arrow.core.getOrElse
fun main() {
Right(12).getOrElse { 17 } // Result: 12
Left(12).getOrElse { 17 } // Result: 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