You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
packer/website/content/docs/templates/hcl_templates/functions/collection/distinct.mdx

25 lines
511 B

---
page_title: distinct function reference
description: The `distinct` function removes duplicate elements from a list. Learn how to use the `distince` function in Packer templates.
---
# `distinct` Function
`distinct` takes a list and returns a new list with any duplicate elements
removed.
The first occurrence of each value is retained and the relative ordering of
these elements is preserved.
## Examples
```shell-session
> distinct(["a", "b", "a", "c", "d", "b"])
[
"a",
"b",
"c",
"d",
]
```