Vibe Engines
YouTube

Vibe Engines is free, interactive AI engineering & system design — runs in your browser. Pick a learning path

Learn RustChapter 1: Hello

Lesson 1.1 · 6 min

What a program is

A computer is fast and completely literal. It does not guess what you meant: it does step one, then step two, then step three. A program is just that list of steps. Everything else in this course is a way of writing better lists.

Adds to ChatterboxNothing yet: you see where we are heading.

A list of steps

Think of a recipe. "Boil water. Add pasta. Wait eight minutes." Whoever follows it does the steps in order and does exactly what is written. A program is a recipe for a computer, except the computer has no common sense, so every step has to be spelled out.

Here is the smallest useful Rust program. You can run it right here: press Run.

The smallest program
fn main() {
println!("Hello from Chatterbox");
}
$ cargo run
Hello from Chatterbox

Three lines, and every piece has a job:

  • fn main() means "the program starts here". Every Rust program has exactly one main.
  • The curly braces { } hold the steps that belong to main.
  • println!("…") is one step: print this text, then start a new line. The ; at the end marks where a step finishes, like a full stop.
PredictSteps run in order
fn main() {
println!("2 + 2 =");
println!("{}", 2 + 2);
}

What does the second line of output say?

  • 4
  • 2 + 2
  • 22
Reveal the answer

The program prints: 4 The first step prints the text 2 + 2 =. The second step prints the result of working out 2 + 2, which is 4. The {} is a hole that the value after the comma fills in. We will use that a lot.

Writing is not running

What you type is just text, and a computer cannot run text. Rust has a helper called the compiler that reads your text and turns it into a real program the computer can run. That translation is called compiling.

So there are two moments: the compiler reads your code (compile time), then the program does its steps (run time). Rust is strict at the first moment so that very little goes wrong at the second. If something in your text does not make sense, the compiler tells you before the program ever starts. You will see that in a few minutes, and by the end of the course you will like it.

What we are building

Over the course you will build one program, a small chat client called Chatterbox. It runs in a terminal (a plain window where you type and read lines of text) and, by the last chapter, talks to a real AI model. Each lesson teaches one idea and ends with that idea added to Chatterbox, so you learn Rust by using it.

Here is a real run of the finished program: the one you will have written yourself by the end of chapter 9, before chapter 10 makes its answers appear word by word. The first box is what a person typed; the second is what Chatterbox printed back. Lines that start with a slash, like /remember and /history, are commands, and you will add each of them one lesson at a time. In this run the replies come from a stand-in "pretend" model, so the run comes out the same every time; a real AI model plugs into the same place. Do not worry about reading all of it yet. Come back at the end and every line will make sense.

You can also talk to it right now. Press Play with it yourself under the run: the finished program starts inside this page, asks your name, and answers what you type. Try /help to see every command. It is the same code you will write, not a copy made to look like it.

Where we are heading: Chatterbox v1.0, the finished program. Press play and talk to it.
You type
Sam
hello!
/remember pizza extra cheese
/recall pizza
/model pretend
can you hear me?
/stats
/history
/quit
Chatterbox prints (a real run)
Chatterbox v1.0 (replies by: echo)
What should I call you?
Hi Sam! I'm Chatterbox. Ask me anything.
bot: you said: hello!
bot: got it: pizza is extra cheese
bot: pizza is extra cheese
bot: replies now come from pretend
bot: (pretend model) I read all 3 messages. You last said: can you hear me?
bot: your top words: can (1), hear (1), hello! (1)
1. you: hello!
2. bot: you said: hello!
3. you: can you hear me?
4. bot: (pretend model) I read all 3 messages. You last said: can you hear me?
bot: bye, Sam!
messages so far: 2
saved 4 messages to chatterbox.json
Self-check

Say it out loud, then reveal

Self-checkRetrieval beats re-reading
In one sentence, what is a program?Reveal
A list of steps that a computer follows exactly, in order.
What does fn main() mark?Reveal
The place where the program starts. Every Rust program has one.
What is the difference between compiling and running?Reveal
Compiling is the compiler turning your text into a real program. Running is that program doing its steps.

That is lesson 1.1. Tick it off so the course remembers where you are.

Questions people ask

Can I learn Rust as my first programming language?

Yes. This course assumes you have never written code. Rust is strict, but its compiler explains what went wrong in plain words, which is a good teacher for a beginner.

What is a compiler?

A compiler is a program that reads the text you write and turns it into a program the computer can run. Rust checks your code carefully at this step, before the program ever starts.

What does println! do in Rust?

println! prints a line of text to the screen and then moves to a new line. The {} inside the quotes is a hole that the value after the comma fills in.

Do I need to install anything to start?

Not for the first lesson: the examples run in your browser. The next lesson shows how to install Rust and run programs on your own computer.

Learn Rust by building a chat app · Lesson 1.1 · every compiler message above is real output from rustc 1.99.0 (b940084d7 2026-09-28) (edition 2024) · Vibe Engines · 2026