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