elixir-book/maps/dynamic_nested.exs

20 lines
310 B
Elixir

nested = %{
buttercup: %{
actor: %{
first: "Robin",
last: "Wright"
},
role: "Princess"
},
westley: %{
actor: %{
first: "Cary",
last: "Elwes"
},
role: "farm boy"
}
}
IO.inspect get_in(nested, [:buttercup])
IO.inspect get_in(nested, [:buttercup, :actor])