In many place syntax like [do: 1] or List.to_tuple(do: 1) comes up. It is confusing when and how it removes the square bracket.
Have you read about Keywords? https://hexdocs.pm/elixir/Keyword.html
4 Likes
It’s a keyword list (a list containing only 2-element tuples and the first element of those tuples are atoms).
iex> [do: 1] == [{:do, 1}]
true
4 Likes