Elixir's documentation states that
In addition to the Elixir file extension .ex, Elixir also supports .exs files for scripting. Elixir treats both files exactly the same way, the only difference is in intention. .ex files are meant to be compiled while .exs files are used for scripting, without the need for compilation.
But I'm still not sure when to use which file type. What are the downsides and the purpose of .ex and .exs?