Map.get_and_update-exclamation-mark

You're seeing just the function get_and_update-exclamation-mark, go back to Map module for more information.
Link to this function

get_and_update!(map, key, fun)

View Source

Specs

get_and_update!(
  map(),
  key(),
  (value() | nil -> {current_value, new_value :: value()} | :pop)
) :: {current_value, map()}
when current_value: value()

Gets the value from key and updates it, all in one pass. Raises if there is no key.

Behaves exactly like get_and_update/3, but raises a KeyError exception if key is not present in map.

Examples

iex> Map.get_and_update!(%{a: 1}, :a, fn current_value ->
...>   {current_value, "new value!"}
...> end)
{1, %{a: "new value!"}}

iex> Map.get_and_update!(%{a: 1}, :b, fn current_value ->
...>   {current_value, "new value!"}
...> end)
** (KeyError) key :b not found in: %{a: 1}

iex> Map.get_and_update!(%{a: 1}, :a, fn _ ->
...>   :pop
...> end)
{1, %{}}