Learn R Programming

MetaRVM (version 1.0.0)

grapes-or-or-grapes: NULL Coalescing Operator

Description

Returns the left-hand side if it's not NULL, otherwise returns the right-hand side. This is a utility function used internally by MetaRVM classes.

Usage

x %||% y

Value

x if x is not NULL, otherwise y

Arguments

x

Left-hand side value

y

Right-hand side value (default/fallback)

Examples

Run this code
if (FALSE) {
user_title <- "User Title"
# Internal usage in classes
title <- user_title %||% "Default Title"
}

Run the code above in your browser using DataLab