Three Ways to Start an Elixir Program

github logo ใƒป1 min read

Elixir Quick Tips (2 Part Series)

1) Recompile Elixir Module in iex 2) Three Ways to Start an Elixir Program

The elixir command used to run a single Elixir source file.

> elixir source.ex

When you run this command two things happen:

  1. The file source.ex is compiled in-memory, and the resulting modules are loaded to the VM.
  2. Every code outside of a module is executed.

The mix tool

> mix run

When you want to run a project created by mix (mix new project_name)

iex Elixir's interactive shell.

> mix my_source_file.ex

When you want to load a module to the VM in interactive mode.
Note that code outside of the module will not be executed.

You can also use mix and run a project and load the interactive shell with iex -S mix run

twitter logo DISCUSS
Classic DEV Post from Aug 6

What to put in your portfolio as a beginner web dev

Tzelon Machluf profile image