Learn R Programming

llmhelper (version 1.0.0)

grapes-or-or-grapes: Null coalescing operator

Description

Returns the left-hand side if it is not NULL, otherwise returns the right-hand side. This is useful for providing default values.

Usage

x %||% y

Value

x if not NULL, otherwise y.

Arguments

x

A value to check for NULL.

y

A default value to return if x is NULL.

Examples

Run this code
NULL %||% "default"
"value" %||% "default"

Run the code above in your browser using DataLab