Introduction to Erlang & VM
Explore the Erlang Virtual Machine (BEAM), basic syntax, data types, and the functional programming mindset required for Erlang development.
Introduction to Erlang & VM is a free Erlang OTP: Distributed & Fault-Tolerant Systems Programming lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Erlang OTP: Distributed & Fault-Tolerant Systems Programming learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Meet Erlang: Built for Reliability
Erlang, built by Ericsson for systems that must never go down, is a functional language for fault-tolerant, concurrent, distributed apps.
The Power of BEAM
Erlang runs on the BEAM virtual machine, which manages millions of lightweight processes — the foundation of its concurrency and fault tolerance.
Your First Erlang Code
Time for Hello World. Erlang code lives in modules (.erl files) that declare a name and export functions by name and arity.
-module(hello_world).
-export([start/0]).
start() ->
io:format("Hello, Erlang!~n").The Erlang Shell: Your Playground
The Erlang shell (start it with erl) lets you type expressions and see results instantly. Remember to end each with a dot.
Variables: Single Assignment
Erlang variables start uppercase and use single assignment: once bound, a value cannot change in scope. That immutability prevents whole bug classes.
-module(variables).
-export([show/0]).
show() ->
X = 10,
Y = X * 2,
io:format("X is: ~w~n", [X]),
io:format("Y is: ~w~n", [Y]).Basic Types: Atoms & More
Core types: atoms (lowercase named constants like ok), numbers (integers and floats), and booleans, which are just the atoms true and false.
-module(basic_types).
-export([display/0]).
display() ->
Status = ok,
Count = 42,
Pi = 3.14159,
IsActive = true,
io:format("Status: ~w~n", [Status]),
io:format("Count: ~w~n", [Count]),
io:format("Pi: ~w~n", [Pi]),
io:format("Is Active: ~w~n", [IsActive]).Tuples: Fixed Collections
A tuple groups a fixed set of elements in curly braces, like {ok, Value}. It is immutable — build a new one to "change" it.
-module(tuples).
-export([show/0]).
show() ->
Person = {person, "Alice", 30, female},
Coordinate = {x, 10, y, 20},
io:format("Person: ~w~n", [Person]),
io:format("Coordinate: ~w~n", [Coordinate]).Lists: Flexible Sequences
A list in square brackets holds any number of ordered elements. You process it recursively as a Head (first item) and Tail (the rest).
-module(lists_example).
-export([show/0]).
show() ->
Numbers = [1, 2, 3, 4, 5],
Colors = [red, green, blue],
MixedList = [atom_name, 123, {tuple, 1}],
io:format("Numbers: ~w~n", [Numbers]),
io:format("Colors: ~w~n", [Colors]),
io:format("Mixed: ~w~n", [MixedList]).Thinking Functionally
Erlang is functional: data is immutable, functions avoid side effects, and functions are first-class values you pass around freely.
Quick Check: Erlang Basics
Let's test your understanding of basic Erlang concepts.
Which of the following statements about Erlang's core features are TRUE?
Recap: Erlang Basics
Recap: Erlang targets fault-tolerant concurrency on the BEAM, with modules, single-assignment variables, and core types like atoms, tuples, and lists.
Frequently asked questions
Is the “Introduction to Erlang & VM” lesson free?
Yes — the full text of “Introduction to Erlang & VM” is free to read here on the web, and the Erlang OTP: Distributed & Fault-Tolerant Systems Programming course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Erlang OTP: Distributed & Fault-Tolerant Systems Programming course, upgrade to CoddyKit PRO.
What will I learn in “Introduction to Erlang & VM”?
Explore the Erlang Virtual Machine (BEAM), basic syntax, data types, and the functional programming mindset required for Erlang development. You practise Erlang OTP: Distributed & Fault-Tolerant Systems Programming with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Erlang OTP: Distributed & Fault-Tolerant Systems Programming?
No prior experience is required. Erlang OTP: Distributed & Fault-Tolerant Systems Programming on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Introduction to Erlang & VM” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Erlang OTP: Distributed & Fault-Tolerant Systems Programming lesson?
Yes. Every Erlang OTP: Distributed & Fault-Tolerant Systems Programming lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Introduction to Erlang & VM
- Erlang Processes & Messaging
- Basic Concurrency Patterns
- Pattern Matching & Guards