Skip to content
Variables and Types
step 1/5

Reading — step 1 of 5

Learn

~1 min readGetting Started

Variables in Elixir are bound with =. Names use snake_case. Reassigning a name doesn't mutate — it just rebinds the name to a new value.

name = "Alice"
age = 30
active = true

Elixir's basic types:

  • Integers (arbitrary precision)
  • Floats (64-bit)
  • Booleans (true, false)
  • Atoms — like Ruby symbols: :ok, :error, :fast — interned, used as identifiers
  • Strings (UTF-8 binaries): "hello"
  • Tuples: {:ok, value} — small fixed collections
  • Lists: [1, 2, 3] — linked list, head/tail style
  • Maps: %{name: "Alice", age: 30} — key-value

Atoms deserve a moment: they're cheap, immutable identifiers. The convention {:ok, value} and {:error, reason} for return values is everywhere in Elixir code.

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…