github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/docs/job-specification/hcl2/functions/collection/coalesce.mdx (about) 1 --- 2 layout: docs 3 page_title: coalesce - Functions - Configuration Language 4 description: |- 5 The coalesce function takes any number of arguments and returns the 6 first one that isn't null nor empty. 7 --- 8 9 # `coalesce` Function 10 11 `coalesce` takes any number of arguments and returns the first one 12 that isn't null or an empty string. 13 14 ## Examples 15 16 ```shell-session 17 > coalesce("a", "b") 18 a 19 > coalesce("", "b") 20 b 21 > coalesce(1,2) 22 1 23 ``` 24 25 To perform the `coalesce` operation with a list of strings, use the `...` 26 symbol to expand the list as arguments: 27 28 ```shell-session 29 > coalesce(["", "b"]...) 30 b 31 ``` 32 33 ## Related Functions 34 35 - [`coalescelist`](/docs/job-specification/hcl2/functions/collection/coalescelist) performs a similar operation with 36 list arguments rather than individual arguments.