Expressions and Expression Sequences

In Erlang, anything that can be evaluated to produce a value is called an expression. This means things such as catch, if, and trycatch are expressions. Things such as record declarations and module attributes cannot be evaluated, so they are not expressions.

Expression sequences are sequences of expressions separated by commas. They are found all over the place immediately following an -> arrow. The value of the expression sequence E1, E2, ..., En is defined to be the value of the last expression in the sequence. This is computed using any bindings created when computing the values of E1, E2, and so on. This is equivalent to progn in LISP.

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.