Learn R Programming

matchr (version 0.1.0)

Try: Execute Expression as Result

Description

Evaluates given expression returning an Err Result if there is an error, otherwise an Ok Result.

Usage

Try(expr)

Arguments

expr

expression to evaluate

Value

Result Enum of variant Ok or Err

Examples

Run this code
# NOT RUN {
# This returns an Err
Try(sqrt + 1)

# This returns an Ok
Try(sqrt(5) + 1)
# }

Run the code above in your browser using DataLab