Introdução a Erlang e à VM
Explore a Máquina Virtual do Erlang (BEAM), a sintaxe básica, os tipos de dados e a mentalidade de programação funcional necessária ao desenvolvimento em Erlang.
Introdução a Erlang e à VM é uma aula grátis de Erlang OTP: Distributed & Fault-Tolerant Systems Programming no CoddyKit. Esta é a aula 1 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de Erlang OTP: Distributed & Fault-Tolerant Systems Programming, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de Erlang OTP: Distributed & Fault-Tolerant Systems Programming inclui 4 aulas no total.
Partes desta aula ainda não foram traduzidas e aparecem em inglês.
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.
Perguntas Frequentes
A aula “Introdução a Erlang e à VM” é grátis?
Sim — o texto completo de “Introdução a Erlang e à VM” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de Erlang OTP: Distributed & Fault-Tolerant Systems Programming, atualize para CoddyKit PRO. O curso de Erlang OTP: Distributed & Fault-Tolerant Systems Programming inclui 4 aulas no total.
O que vou aprender em “Introdução a Erlang e à VM”?
Explore a Máquina Virtual do Erlang (BEAM), a sintaxe básica, os tipos de dados e a mentalidade de programação funcional necessária ao desenvolvimento em Erlang. Você pratica Erlang OTP: Distributed & Fault-Tolerant Systems Programming com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.
Preciso ter experiência prévia para começar Erlang OTP: Distributed & Fault-Tolerant Systems Programming?
Nenhuma experiência prévia é necessária. Erlang OTP: Distributed & Fault-Tolerant Systems Programming no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 1 de 4.
Quanto tempo leva a aula “Introdução a Erlang e à VM”?
A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.
Posso escrever e executar código nesta aula de Erlang OTP: Distributed & Fault-Tolerant Systems Programming?
Sim. Cada aula de Erlang OTP: Distributed & Fault-Tolerant Systems Programming inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.
Todas as aulas deste curso
- Introdução a Erlang e à VM
- Processos e troca de mensagens em Erlang
- Padrões básicos de concorrência
- Correspondência de Padrões e Guardas