Elixir Language Maps and Keyword Lists Creating a Keyword List


Keyword lists are tuples of key/value, generally used as options for a function call.

[{:a, 1}, {:b, 2}] // creates a non-empty keyword list

Keyword lists can have the same key repeated more than once.

[{:a, 1}, {:a, 2}, {:b, 2}]
[{:a, 1}, {:b, 2}, {:a, 2}]

Keys and values can be any type:

[{"a", 1}, {:a, 2}, {2, "b"}]