Elixir Language Maps and Keyword Lists

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • map = %{} // creates an empty map
  • map = %{:a => 1, :b => 2} // creates a non-empty map
  • list = [] // creates an empty list
  • list = [{:a, 1}, {:b, 2}] // creates a non-empty keyword list

Remarks

Elixir provides two associative data structures: maps and keyword lists.

Maps are the Elixir key-value (also called dictionary or hash in other languages) type.

Keyword lists are tuples of key/value that associate a value to a certain key. They are generally used as options for a function call.



Got any Elixir Language Question?