Chapter 2. Modules

Working with the interactive shell is a vital part of using dynamic programming languages. It’s useful to test all kinds of code and programs. In Chapter 1, we used the interactive shell to play with most of Erlang’s basic data types without ever opening a text editor or saving a file. While you could stop reading here, go play ball outside, and call it a day, that would make you a terrible Erlang programmer. Code needs to be saved somewhere to be used! As you’ll learn in this chapter, that’s what modules are for.

What Are Modules?

A module is a bunch of functions grouped together in a single file, under a single name. All functions in Erlang must be defined in modules. You have already used modules, perhaps without realizing ...

Get Learn You Some Erlang for Great Good! now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.