Returns a fallback
value if primary
is null
.
otherwise(primary:any, fallback:any) -> any
Description
Section titled “Description”The otherwise
function evaluates its arguments and replaces primary
with
fallback
where primary
would be null
.
primary: any
Section titled “primary: any”The expression to return if not null
.
fallback: any
Section titled “fallback: any”The expression to return if primary
evaluates to null
.
Examples
Section titled “Examples”Set a default value for a key
Section titled “Set a default value for a key”from {x: 1}, {x: 2}, {}x = x.otherwise(-1)
{x: 1}{x: 2}{x: -1}