Skip to content

Commit 73a76c6

Browse files
committed
Update example to use Map.put/3, accordingly with the last proposal
[Proposal 1](https://gist.github.com/josevalim/9acd0fe43063cbc33aa6) has the update operation also put new keys in the map, while the [2nd proposal](https://gist.github.com/josevalim/b30c881df36801611d13) doesn't support this. The docs reflected the first proposal.
1 parent 002bf16 commit 73a76c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/elixir/lib/kernel/special_forms.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ defmodule Kernel.SpecialForms do
138138
regular map operations:
139139
140140
user = %User{}
141-
%{ user | a_non_struct_key: :value }
141+
Map.put(user, :a_non_struct_key, :value)
142142
143143
An update operation specific for structs is also available:
144144

0 commit comments

Comments
 (0)