published: 29th of January 2021
Keyword lists are similar to list. They are a sequence of tuples that are enclosed with square brackets [{}, {}] .
Becasue keyword lists are lists they support all the operations that can be perfomed on a list.
# Define a keyword list
keyword_list = [{:stuff, "stuff"}, {:things, "things"}]
# Special syntax to define a keyword list
keyword_list = [stuff: "stuff", things: "things"]
# Pass keyword list to function
if(false, [{:do, :this}, {:else, :that}])
# syntastic sugar version
if false, do: :this, else: :that
https://elixir-lang.org/getting-started/keywords-and-maps.html#keyword-lists
https://learning.oreilly.com/library/view/elixir-in-action/9781617295027/c02.xhtml