Different Ways to Run Your Program
Erlang programs are stored in modules. Once you have written your program, you have to compile it before you can run it. Alternatively, you can run your program directly without compiling it by running an escript.
The next sections show how to compile and run a couple of programs in a number of ways. The programs are slightly different, and the ways in which we start and stop them differ.
The first program, hello.erl, just prints
“Hello world.” It’s not responsible for starting
or stopping the system, and it does not need to access any
command-line arguments. By way of contrast, the second
program, fac, needs to access the command-line arguments.
Here’s our basic program. It writes the string containing ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access