Structs
In chapter 7 we learned about maps:
iex> map = %{a: 1, b: 2}
%{a: 1, b: 2}
iex> map[:a]
1
iex> %{map | a: 3}
%{a: 3, b: 2}
Structs are extensions built on top of maps that provide compile-time checks and default values.
In chapter 7 we learned about maps:
iex> map = %{a: 1, b: 2}
%{a: 1, b: 2}
iex> map[:a]
1
iex> %{map | a: 3}
%{a: 3, b: 2}
Structs are extensions built on top of maps that provide compile-time checks and default values.