Learn R Programming

matchr (version 0.1.0)

is.err: Check if Result is an Err

Description

Test whether Result Enum is Ok or an Err.

Usage

is.err(x)

Arguments

x

object to be tested

Value

TRUE if x is enumerated type of variant Err, 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.err(x)  # TRUE

# }

Run the code above in your browser using DataLab