op-null-default: Null-coalescing operator

op-null-defaultR Documentation

Null-coalescing operator

Description

Returns x if it is not NULL, otherwise returns y. Equivalent to rlang::%||% but without requiring that dependency.

Usage

x %||% y

Arguments

x

Value to test

y

Fallback value if x is NULL

Value

x if not NULL, otherwise y

Examples

NULL %||% "default"
"value" %||% "default"
list()$missing %||% 0

fb4package documentation built on May 8, 2026, 1:07 a.m.