20032013 Ericsson AB. All Rights Reserved. The contents of this file are subject to the Erlang Public License, Version 1.1, (the "License"); you may not use this file except in compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. Introduction introduction.xml
Purpose

This reference manual describes the Erlang programming language. The focus is on the language itself, not the implementation. The language constructs are described in text and with examples rather than formally specified, with the intention to make the manual more readable. The manual is not intended as a tutorial.

Information about this implementation of Erlang can be found, for example, in System Principles (starting and stopping, boot scripts, code loading, error logging, creating target systems), Efficiency Guide (memory consumption, system limits) and ERTS User's Guide (crash dumps, drivers).

Prerequisites

It is assumed that the reader has done some programming and is familiar with concepts such as data types and programming language syntax.

Document Conventions

In the document, the following terminology is used:

A sequence is one or more items. For example, a clause body consists of a sequence of expressions. This means that there must be at least one expression. A list is any number of items. For example, an argument list can consist of zero, one or more arguments.

If a feature has been added recently, in Erlang 5.0/OTP R7 or later, this is mentioned in the text.

Complete List of BIFs

For a complete list of BIFs, their arguments and return values, refer to erlang(3).

Reserved Words

The following are reserved words in Erlang:

after and andalso band begin bnot bor bsl bsr bxor case catch cond div end fun if let not of or orelse query receive rem try when xor

Character Set

In Erlang 4.8/OTP R5A the syntax of Erlang tokens was extended to allow the use of the full ISO-8859-1 (Latin-1) character set. This is noticeable in the following ways:

All the Latin-1 printable characters can be used and are shown without the escape backslash convention.

Atoms and variables can use all Latin-1 letters.

Octal Decimal   Class 200 - 237 128 - 159   Control characters 240 - 277 160 - 191 - ¿ Punctuation characters 300 - 326 192 - 214 À - Ö Uppercase letters 327 215 × Punctuation character 330 - 336 216 - 222 Ø - Þ Uppercase letters 337 - 366 223 - 246 ß - ö Lowercase letters 367 247 ÷ Punctuation character 370 - 377 248 - 255 ø - ÿ Lowercase letters Character Classes.

In Erlang/OTP R16 the syntax of Erlang tokens was extended to handle Unicode. To begin with the support is limited to strings, but Erlang/OTP R18 is expected to handle Unicode atoms as well. More about the usage of Unicode in Erlang source files can be found in STDLIB's User'S Guide. The default encoding for Erlang source files is still Latin-1, but in Erlang/OTP R17 the default encoding will be UTF-8. The details on how to state the encoding of an Erlang source file can be found in epp(3).