0Pricing
Erlang OTP: Distributed & Fault-Tolerant Systems Programming · Lekcja

Wprowadzenie do Erlanga i maszyny wirtualnej

Poznaj maszynę wirtualną Erlanga (BEAM), podstawową składnię, typy danych i sposób myślenia funkcyjnego potrzebny podczas tworzenia oprogramowania w Erlangu.

Wprowadzenie do Erlanga i maszyny wirtualnej to bezpłatna lekcja Erlang OTP: Distributed & Fault-Tolerant Systems Programming na CoddyKit. To lekcja 1 z 4. Możesz przeczytać całą lekcję poniżej za darmo — a potem ćwiczyć ją interaktywnie w przeglądarce z wbudowanym edytorem kodu i tutorem AI dostępnym 24/7. To część ścieżki edukacyjnej Erlang OTP: Distributed & Fault-Tolerant Systems Programming, a Twój postęp synchronizuje się między webem a aplikacją CoddyKit. Kurs Erlang OTP: Distributed & Fault-Tolerant Systems Programming zawiera 4 lekcji w sumie.

Części tej lekcji nie zostały jeszcze przetłumaczone i są wyświetlane po angielsku.

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.

Często zadawane pytania

Czy lekcja „Wprowadzenie do Erlanga i maszyny wirtualnej” jest bezpłatna?

Tak — pełny tekst „Wprowadzenie do Erlanga i maszyny wirtualnej” jest dostępny za darmo tutaj w sieci. Aby ćwiczyć ją interaktywnie (wbudowany edytor kodu i tutor AI dostępny 24/7) i odblokować resztę kursu Erlang OTP: Distributed & Fault-Tolerant Systems Programming, przejdź na CoddyKit PRO. Kurs Erlang OTP: Distributed & Fault-Tolerant Systems Programming zawiera 4 lekcji w sumie.

Co nauczysz się w „Wprowadzenie do Erlanga i maszyny wirtualnej”?

Poznaj maszynę wirtualną Erlanga (BEAM), podstawową składnię, typy danych i sposób myślenia funkcyjnego potrzebny podczas tworzenia oprogramowania w Erlangu. Ćwiczysz Erlang OTP: Distributed & Fault-Tolerant Systems Programming z praktycznym kodem, który uruchamiasz bezpośrednio w przeglądarce, a tutor AI dostępny 24/7 odpowiada na Twoje pytania podczas pracy nad lekcją.

Czy potrzebuję doświadczenia, aby zacząć Erlang OTP: Distributed & Fault-Tolerant Systems Programming?

Nie wymagamy żadnego doświadczenia. Erlang OTP: Distributed & Fault-Tolerant Systems Programming w CoddyKit jest strukturyzowany dla początkujących i zaawansowanych użytkowników, więc możesz zacząć tutaj lub od początku i uczyć się w swoim tempie. To lekcja 1 z 4.

Ile czasu zajmuje lekcja „Wprowadzenie do Erlanga i maszyny wirtualnej”?

Większość lekcji CoddyKit trwa około 5–10 minut. Każda lekcja to mały, interaktywny krok, dzięki czemu robisz systematyczne postępy i zawsze wracasz dokładnie do tego samego miejsca — na webie i w aplikacji.

Czy mogę pisać i uruchamiać kod w tej lekcji Erlang OTP: Distributed & Fault-Tolerant Systems Programming?

Tak. Każda lekcja Erlang OTP: Distributed & Fault-Tolerant Systems Programming zawiera wbudowany edytor kodu, więc piszesz i uruchamiasz prawdziwy kod bezpośrednio w przeglądarce i od razu otrzymujesz sprzężenie zwrotne od AI — bez konfiguracji na komputerze.

Wszystkie lekcje w tym kursie

  1. Wprowadzenie do Erlanga i maszyny wirtualnej
  2. Procesy i komunikacja w Erlangu
  3. Podstawowe wzorce współbieżności
  4. Dopasowywanie wzorców i strażnicy
← Powrót do Erlang OTP: Distributed & Fault-Tolerant Systems Programming