· About
· Downloads
· Links
· FAQs + mailing lists
· Enhancements
· Getting started
· Documentation
· Examples
· Mirrors

Erlang Books

For comments or questions about this site, contact

Starting Erlang

If you are running on a Unix system type "erl" or, if you are running on Windows start Erlang by clicking on the Erlang start icon. You should see something like this:

os prompt > erl
Erlang R13B (erts-5.7.1) [smp:4:4] [rq:4] [async-threads:0] [kernel-poll:false]

Eshell V5.7.1  (abort with ^G)

The ">" prompt means the system is waiting for input.

Using Erlang as a Calculator

1> 2131836812671*12937192739173917823.

Remember to terminate every expression with a DOT followed by a whitespace!

Editing previous expressions

Previous expressions can be retrieved and edited using simple emacs line editing commands. The most common of these are:

Fetch the previous line.
Fetch the next line.
Go to the beginning of the current line.
Go to the end of the current line.
Delete the character under the cursor.
Go forward by one character.
Go Back by one character.
Evaluate the current command.

Note: ^X means press Control + X. On many systems these control sequences are also mapped to the Arrow (Up,Down,Left,Right) keys.

Try typing Control+P to see what happens.

Compiling your first program

Type the following into a file using your favorite text editor:


fac(0) -> 1;
fac(N) -> N * fac(N-1).

Store this in a file called test.erl The file name must be the same as the module name. Compile the program by typing c(test) then run it:

3> c(test).
4> test:fac(20).
5> test:fac(40). 

Last updated   2010-11-29 13:15 UTC