Keyword Lists and Maps
Learn how to use keyword lists and maps in Elixir.
We'll cover the following
Keyword lists
In many functional programming languages, it’s common to use a list of 2-item tuples as the representation of a key-value data structure. In Elixir, when we have a list of tuples and the first item of the tuple (known as the key) is an atom, we call it a keyword list. Keyword lists are typically used in the context of options passed to functions.
Here’s an example. Run the Canvas.draw_text("hello", fg: "red", style: "italic", style: "bold")
command to execute the code below.
Get hands-on with 1400+ tech skills courses.