Files
opentf/website/docs/configuration/functions/zipmap.html.md
Martin Atkins e7d71995f6 website: Document the remaining "collection" functions
This also renames some of the existing function pages whose source
filenames were not matching the usual naming scheme (.html.md).
2018-10-16 18:47:33 -07:00

842 B

layout, page_title, sidebar_current, description
layout page_title sidebar_current description
functions zipmap function docs-funcs-collection-zipmap The zipmap function constructs a map from a list of keys and a corresponding list of values.

zipmap Function

zipmap constructs a map from a list of keys and a corresponding list of values.

zipmap(keyslist, valueslist)

Both keyslist and valueslist must be of the same length. keyslist must be a list of strings, while valueslist can be a list of any type.

Each pair of elements with the same index from the two lists will be used as the key and value of an element in the resulting map. If the same value appears multiple times in keyslist then the value with the highest index is used in the resulting map.

Examples

> zipmap(["a", "b"], [1, 2])
{
  "a" = 1,
  "b" = 2,
}