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
