Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Function

coalesce — return first value that is not null or an error

Synopsis

coalesce(val: any [, ... val: any]) -> any

Description

The coalesce function returns the first of its arguments that is not null or an error. It returns null if all its arguments are null or an error.

Examples


# spq
values coalesce(null, error("missing"), error({x:"foo"}), this)
# input
1
# expected output
1

# spq
values coalesce(null, error({x:"foo"}), this)
# input
error("quiet")
# expected output
null