Values and types

This part is the data the rest of the Erlang course works with: a variable bound once, integers of any size, atoms, strings and binaries. A value never changes in place, so a name either matches the value or the process fails, and there is no third outcome.

The last four lessons go past the first look: comparisons say which of two terms is smaller, conversions move a value between its forms, and the bit syntax builds a binary from fields and takes it apart again. Every example is a shell session or a module the container compiled.

2.1 Variables and single assignment a name bound once, the equals sign as a match, and where a binding lives Open 2.2 Numbers integers of any size, floats, div and rem, and the math module Open 2.3 Atoms a name as a value, the atom table, and the atoms the runtime uses Open 2.4 Strings and binaries a string as a list of codes, binaries, escapes and the output forms Open 2.5 No truthiness: a condition must be true why a guard needs the atom true, and why 0 and the empty list are not false Open 2.6 Comparisons and equality =:= and ==, the order of terms, and the comparison a guard allows Open 2.7 Type conversions between numbers, atoms, lists and binaries, and the iolist that joins them Open 2.8 Bit syntax build a binary from fields and match it back segment by segment Open 2.9 Binaries in depth binary patterns with sizes, UTF-8, and an iolist that never copies Open

Lessons