The Shell

The Erlang shell is where you’ll spend most of your time. You enter an expression, and the shell evaluates the expression and prints the result.

 
$ ​erl
 
Erlang R16B ...
 
Eshell V5.9 (abort with ^G)
 
1>​ 123456 * 223344.
 
27573156864

So, what happened? $ is the operating system prompt. We typed the command erl, which started the Erlang shell. The Erlang shell responds with a banner and the numbered prompt 1>. Then we typed in an expression, which was evaluated and printed. Note that each expression must be finished with a dot followed by a whitespace character. In this context, whitespace means a space, tab, or carriage return character.

Beginners often forget to finish expressions with the dot whitespace bit. Think of a command ...

Get Programming Erlang, 2nd Edition 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.