arrow-core-data / arrow.core / Ior / orNull

orNull

fun orNull(): B?

Returns the Right value or B if this is Right or Both and null if this is a Left.

Example:

import arrow.core.Ior

//sampleStart
val right = Ior.Right(12).orNull()         // Result: 12
val left = Ior.Left(12).orNull()           // Result: null
val both = Ior.Both(12, "power").orNull()  // Result: "power"
//sampleEnd
fun main() {
  println("right = $right")
  println("left = $left")
  println("both = $both")
}

Do you like Arrow?

Arrow Org
<