2018-05-12 18:39:29 +02:00
|
|
|
---
|
|
|
|
layout: "functions"
|
2018-12-20 05:35:11 +01:00
|
|
|
page_title: "coalesce - Functions - Configuration Language"
|
2018-05-12 18:39:29 +02:00
|
|
|
sidebar_current: "docs-funcs-collection-coalesce-x"
|
|
|
|
description: |-
|
|
|
|
The coalesce function takes any number of string arguments and returns the
|
|
|
|
first one that isn't empty.
|
|
|
|
---
|
|
|
|
|
|
|
|
# `coalesce` Function
|
|
|
|
|
|
|
|
`coalesce` takes any number of string arguments and returns the first one
|
|
|
|
that isn't empty.
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
```
|
|
|
|
> coalesce("a", "b")
|
|
|
|
a
|
|
|
|
> coalesce("", "b")
|
|
|
|
b
|
|
|
|
```
|
|
|
|
|
|
|
|
To perform the `coalesce` operation with a list of strings, use the `...`
|
|
|
|
symbol to expand the list as arguments:
|
|
|
|
|
|
|
|
```
|
|
|
|
> coalesce(["", "b"]...)
|
|
|
|
b
|
|
|
|
```
|
|
|
|
|
|
|
|
## Related Functions
|
|
|
|
|
|
|
|
* [`coalescelist`](./coalescelist.html) performs a similar operation with
|
|
|
|
list arguments rather than string arguments.
|