Strings

Let’s learn about the properties of different types of strings in Elixir.

We’ve already covered one of our suggestions, to prefer strings for user-defined text and atoms for naming concepts in code. In this section, we’re going to dive a little deeper. Elixir’s strings have slightly different characteristics from maps or lists, and we should know about those subtle differences. Let’s talk a bit about these concepts. Elixir has the following two categories of strings:

Charlist

The chartist is just a list of characters. We can see it in action by entering the following list into the iex terminal:

Executable

Get hands-on with 1200+ tech skills courses.