Last active
May 22, 2023 17:37
-
-
Save brettinternet/c0e5b941350b4d11b0276a05785f2f32 to your computer and use it in GitHub Desktop.
Accessing values in maps, keyword lists, and structs in Elixir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Accessing values in maps, keyword lists, and structs | |
# 1. using . they key can’t be missing, works with structs or maps, but not with keyword lists | |
# 2. using […] works on maps and keyword lists, but not structs. Key can be missing and i’ll return nil | |
# 3. Map.get(…) works on maps and structs, but not keyword lists. will return nil if key is missing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If this is wrong then blame @atomkirk 😏