Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 512 Bytes

create-a-list-of-atoms.md

File metadata and controls

19 lines (14 loc) · 512 Bytes

Create A List Of Atoms

The ~w sigil makes it easy to create a word list -- a list of strings -- where each word is separated by a space.

> ~w(bulbasaur charmander squirtle)
["bulbasaur", "charmander", "squirtle"]

By appending an a onto that sigil construct, you are instructing Elixir that you would instead like a list of atoms.

> ~w(bulbasaur charmander squirtle)a
[:bulbasaur, :charmander, :squirtle]

source