IEx - Interactive Elixir REPL | Online Free DevTools by Hexmos

Explore IEx, the Interactive Elixir REPL. Learn how to run, use, and leverage its powerful features for Elixir development.

IEx - Interactive Elixir REPL

IEx: The Interactive Elixir REPL

IEx is the Interactive Elixir Read-Eval-Print Loop, a powerful console that comes bundled with your Elixir installation. It's an essential tool for developers to experiment with Elixir code, debug issues, and explore the language interactively.

Running IEx

To start using IEx, simply open your command prompt or terminal and type iex. This will launch the interactive session. You can also run IEx with a specific Elixir file by typing iex some_file.ex. This command will compile the specified file and then load it into the IEx environment, allowing you to immediately work with its definitions.

Leveraging IEx Features

IEx offers built-in tab completion, which is incredibly useful for discovering available functions and modules. At an empty prompt, pressing the Tab key will display all functions and modules accessible in the current scope. This feature significantly speeds up the process of writing and exploring Elixir code.

Useful IEx Helper Functions

  • h/0: Displays documentation for IEx helper functions.
  • h/1: Provides documentation for a specific Module or Function.
  • i/1: Shows detailed information about a given value or variable.
  • c/1: Compiles and loads an Elixir file into the current IEx session.
  • r/1: Reloads a previously compiled module, useful for seeing changes without restarting the session.

Further Exploration: To integrate IEx with your Mix projects, you can use the command iex -S mix. This loads your project's dependencies and environment into the IEx session, allowing you to test your project code directly.

External Resources