Recompiling and reloading modules/files in iex
When you are testing code in Elixir and you've made a change to the source file you may want to reload the new code. iex
provides two options of doing it:
-
By file name:
iex> c "lib/myfile.ex"
-
By module
iex> r MyModule
The way r
works is it checks where the module is defined and then recompiles all of the code in that file as c
does.