common fun orNull(): B?

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


import arrow.core.Ior

fun main() {
  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"

  println("right = $right")
  println("left = $left")
  println("both = $both")

Do you like Arrow?

Arrow Org