Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Ericsson engineers designed Erlang in 1986 to run telephone switches that were never allowed to stop — and that requirement produced a language decades ahead of its time. Lightweight processes, message passing, supervision trees, and hot code swapping let systems achieve legendary uptime; WhatsApp famously served hundreds of millions of users with a tiny Erlang team, and RabbitMQ, CouchDB, and much telecom infrastructure run on it today. The runtime (BEAM) is actively developed, with OTP 27 and 28 as recent releases. Erlang is also academically significant as the canonical actor-model language, cited in virtually every concurrency course. Here you can execute Erlang in a live terminal — io:get_line reads what you type mid-run, with zero toolchain setup.
main(_) ->
Name = string:trim(io:get_line("What's your name? ")),
io:format("Hello, ~s! Spawning a process for you.~n", [Name]),
Parent = self(),
spawn(fun() -> Parent ! {note, "delivered by a lightweight process"} end),
receive
{note, Msg} -> io:format("Message ~s~n", [Msg])
end,
{ok, [N]} = io:fread("Factorial of what number? ", "~d"),
io:format("~b! = ~b~n", [N, fact(N)]).
fact(0) -> 1;
fact(N) when N > 0 -> N * fact(N - 1).
Erlang shows up in two career paths: distributed-systems engineering (messaging infrastructure like RabbitMQ, telecom, IoT backends) and as the foundation beneath Elixir, where understanding OTP concepts distinguishes senior candidates. Concurrency and programming-languages courses assign Erlang to teach the actor model, immutability, and pattern matching with guards — exactly the constructs you can drill on this page. It's also the fastest way to test recursion patterns, list comprehensions, and message-passing snippets from Armstrong's 'Programming Erlang' without configuring rebar3 or a local OTP release.
Yes. io:get_line and io:fread block the running program until you enter a line in the terminal, and io:format output appears immediately beforehand — so prompts and answers interleave live, like an escript run in a local shell. Sequential interactive prompts work without any special handling.
Write it script-style with a main/1 entry point, as in the example: execution starts at main and you can define additional functions below it with the usual clause-and-guard syntax. This mirrors how escript runs single files, so translating your code into a proper -module(...) later is mechanical.
The standard library and OTP modules that ship with Erlang (lists, maps, string, ets, gen_server and other behaviours) are present — no external packages, no rebar3 dependencies, single file only. Full supervision-tree applications are awkward in one script, but you can absolutely exercise processes, messages, and ets tables.
main.erlerlangio:get_line()-module(main).
-export([main/1]).
main(_) ->
io:format("Hello from Erlang!~n"),
io:format("Welcome to XCODX Online Compiler!~n").