Today I Learned

hashrocket A Hashrocket project

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:

  1. By file name:

     iex> c "lib/myfile.ex"
  2. 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.

See More #elixir TILs
Looking for help? At Hashrocket, we 💜 Elixir! From our many Elixir client projects, to sponsoring the Chicago Elixir Meetup, to the source code for this application, we are invested in this community. Contact us today to talk about your Elixir project.