liveBook · Manning

IEx application

As explained in Elixir in Action, Third Edition

IEx is Elixir's interactive command-line shell for evaluating code and inspecting runtime values.

IEx is Elixir’s interactive command-line shell for evaluating expressions and inspecting their return values. Starting `iex` launches a BEAM instance, reports runtime versions, and provides a prompt where valid Elixir code can be executed. section 2.1

The shell accepts multiline expressions without semicolons: it evaluates only after the parser sees a complete expression. Use `#iex:break` to abandon incomplete input, and remember that Ctrl-C twice forcibly terminates the shell and its background jobs. section 2.1

Use IEx in progressively larger environments:

  • Run `iex` for quick experiments with Elixir expressions, types, functions, and runtime values. section 2.1 section 2.8
  • Run `iex -S mix` to compile a Mix project and interact with its modules, such as starting and querying a `Todo.Server` process. section 7.1
  • Use a release’s `start_iex` command for a remote shell whose code paths point into the self-contained release. section 13.2.3
$ iex
Erlang/OTP 26 [erts-14.0] [source] [64-bit] [smp:20:20] [ds:20:20:10]

Interactive Elixir (1.15.0) - press Ctrl+C to exit
 (type h() ENTER for help)

iex(1)>

Shows the startup banner, runtime information, and prompt produced by launching `iex`. section 2.1

$ iex -S mix

iex(1)> {:ok, todo_server} = Todo.Server.start()

iex(2)> Todo.Server.add_entry(
         todo_server,
         %{date: ~D[2023-12-19], title: "Dentist"}
       )

iex(3)> Todo.Server.entries(todo_server, ~D[2023-12-19])
[%{date: ~D[2023-12-19], id: 1, title: "Dentist"}]

Demonstrates compiling a Mix project, starting its shell, and exercising a concurrent server through IEx. section 7.1

How Elixir in Action, Third Edition covers it

How deep it goes
Explains startup, expression parsing, interruption, Mix integration, and release load paths, but defers detailed Mix treatment.
Examples
Uses arithmetic, multiline expressions, help commands, a Todo.Server session, and release load-path inspection.
What it assumes
Assumes command-line access and valid Elixir code while teaching shell startup, expression completion, and project attachment.
What you can do after
Operate Elixir systems interactively, from isolated expressions through Mix projects and release-based remote sessions.
How it connects
Connects interactive evaluation with BEAM, Elixir expressions, Mix projects, OTP applications, releases, and remote shells.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Elixir in Action, Third Edition. The section links point to the parts of the book it draws on.