Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions lib/elixir/lib/keyword.ex
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,17 @@ defmodule Keyword do
iex> [{:active, :once}]
[active: :once]

The two syntaxes are completely equivalent. Note that when keyword
lists are passed as the last argument to a function, if the short-hand
syntax is used then the square brackets around the keyword list can
be omitted as well. For example, the following:
The two syntaxes are completely equivalent. When using the colon syntax,
the key is always an atom, even when wrapped in quotes:

iex> ["exit_on_close": true]
[exit_on_close: true]

This mirrors the quoted atom syntax such as `:"exit_on_close"`.

Note that when keyword lists are passed as the last argument to a function,
if the short-hand syntax is used then the square brackets around the keyword list
can be omitted as well. For example, the following:

String.split("1-0", "-", trim: true, parts: 2)

Expand Down