Working with Text
7 min · Elixir
Join strings, measure them, and embed values with interpolation.
Enemy 1 of 5
Strings are binaries
This code joins two strings with the <> operator and prints the result. Press Run to see Hello, Ada.
Why this works
Elixir strings are UTF-8 encoded binaries under the hood. You don't need to think about that detail day-to-day, but it explains why string operations in Elixir are consistently fast and why Elixir handles international text correctly by default. Day-to-day, a string is just text wrapped in double quotes, same as most languages.
Two strings are joined end-to-end with `<>`, the concatenation operator, deliberately distinct from `+`, which is reserved for numbers. This is a small but useful design choice: in Elixir, `+` and `<>` can never be confused with each other, unlike languages that overload `+` to mean both "add" and "concatenate" depending on the types involved.
Rena
Your AI tutor. She walks you through each step.
Asking for help is part of coding. Rena reads your code and gives you a hint. She is free with an account: 20 hints a day.