Elixir file extensions for new developers
This and the other “Deck” posts are a repurposing of flashcard study decks to Q&A blog posts.
When would you use the .ex extension for an Elixir file vs `.exs`?
You use .ex
when you want to compile your code and .ex
when writing a script.
How would you execute a .exs file script from the command line?
elixir my_exs_file.exs
Running the script above will execute the file without writing a compiled BEAM file to disk.
How would you execute a .ex file on the command line?
elixirc my_exs_file.ex
The above will write a compiled BEAM file to disk and you will be able to use the modules/functions you create in your Elixir environment.