Keyword.pop
You're seeing just the function
pop
, go back to Keyword module for more information.
Specs
Returns the first value for key
and removes all associated entries in the keyword list.
It returns a tuple where the first element is the first value for key
and the
second element is a keyword list with all entries associated with key
removed.
If the key
is not present in the keyword list, {default, keyword_list}
is
returned.
If you don't want to remove all the entries associated with key
use pop_first/3
instead, that function will remove only the first entry.
Examples
iex> Keyword.pop([a: 1], :a)
{1, []}
iex> Keyword.pop([a: 1], :b)
{nil, [a: 1]}
iex> Keyword.pop([a: 1], :b, 3)
{3, [a: 1]}
iex> Keyword.pop([a: 1, a: 2], :a)
{1, []}