Skip to content

Instantly share code, notes, and snippets.

@brettinternet
Last active May 22, 2023 17:37
Show Gist options
  • Save brettinternet/c0e5b941350b4d11b0276a05785f2f32 to your computer and use it in GitHub Desktop.
Save brettinternet/c0e5b941350b4d11b0276a05785f2f32 to your computer and use it in GitHub Desktop.
Accessing values in maps, keyword lists, and structs in Elixir
# 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
@brettinternet
Copy link
Author

brettinternet commented Nov 9, 2021

If this is wrong then blame @atomkirk 😏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment