Introduction
Elixir modules are files (see the following information box) where related functions are grouped and stored. In Chapter 1, Command Line, we covered how to load and compile our own modules in IEx and how to generate applications with Mix. Mix applications are a collection of modules within a predefined directory structure.
Modules are defined using the defmodule
macro and functions using the def
and defp
macros.
Note
In this chapter, we will be developing some concepts that are specifically related to modules and functions. It is also possible to define modules inside IEx without storing them to files.