getOrElse

inline fun <L, R> Either<L, R>.getOrElse(value: R): R

Returns the value from this Right or the given argument if this is a Left. Right(12).getOrElse(17) RETURNS 12 and Left(12).getOrElse(17) RETURNS 17


inline fun <L, R> Either<L, R>.getOrElse(fn: (L) -> R): R

Returns the value from this Right or the result of fn if this is a Left. Right(12).getOrElse{ it + 3 } RETURNS 12 and Left(12).getOrElse{ it + 3 } RETURNS 15