The coalesce function takes a list of values and returns the first non-empty one.

coalesce 0 1 2

The above returns 1.

This function is useful for scanning through multiple variables or values:

coalesce .name "Matt"

The above will first check to see if .name is empty. If it is not, it will return that value. If it is empty, coalesce will evaluate for emptiness. Finally, if both .name and are empty, it will return Matt.

Back to top