Skip to content
Lesson 2 of 15

Step 1 of 5 · Reading · ~1 min

Learn

Getting 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.

Up nextNumbers and MathGetting Started

Discussion

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

Sign in to post a comment or reply.

Loading…

Variables and Types — Elixir Fundamentals