Learn R Programming

matchr (version 0.1.0)

is.ok: Check if Result is Ok

Description

Test whether Result Enum is Ok or an Err.

Usage

is.ok(x)

Arguments

x

object to be tested

Value

TRUE if x is enumerated type of variant Ok, FALSE otherwise

Examples

Run this code
# NOT RUN {
sqrt_big <- function(x) {
  if (x > 1000){ return(Ok(sqrt(x))) }
  Err("Not large enough!")
}
x <- sqrt_big(250)
is.ok(x)  # FALSE

# }

Run the code above in your browser using DataLab