Vibe Engines
YouTube

Lesson 1.4 · 6 min

Chatterbox says hello

Time to add the first real piece to Chatterbox: a greeting that uses your name. Small, but it is a complete program, and it is the base every later lesson builds on.

Adds to ChatterboxA greeting that fills in your name.

Chatterbox v0.1

Put the last three lessons together. The program prints a banner, then a greeting that uses a name. Right now the name is typed straight into the code. In chapter 2 you will give it a proper name, and chapter 3 makes Chatterbox read what you type. For now we are only checking that the whole path works: text goes in, the compiler agrees, and a friendly line comes out.

Run it below. Change "Sam" to your own name first; that is a real edit to a real program.

src/main.rs: Chatterbox so far
fn main() {
println!("{} v{}", "Chatterbox", "0.1");
println!("Hi {}! I'm {}.", "Sam", "Chatterbox");
}
$ cargo run
Chatterbox v0.1
Hi Sam! I'm Chatterbox.

The two highlighted lines are what this lesson adds. Read them aloud: the first fills two holes with a name and a version; the second fills two holes with a person and the bot.

Notice the repetition: "Chatterbox" appears twice. If the bot changed its name you would have to change it in two places and hope you found them both. Chapter 2 fixes exactly that.

Try itYour turn: a greeting for anyone

Make greeting return Hi Sam! I'm Chatterbox. for the name "Sam", and the same sentence with any other name. Fill the blank. &str means a piece of fixed text; chapter 2, lesson 4 explains it (a preview of what is coming).

Make greeting return Hi Sam! I'm Chatterbox. for the name "Sam", and the same sentence with any other name. Fill the blank. &str means a piece of fixed text; chapter 2, lesson 4 explains it (a preview of what is coming).

fn greeting(name: &str) -> String {
// build: Hi <name>! I'm Chatterbox.
String::new()
}
 
fn main() {
println!("{}", greeting("Sam"));
}

Hidden tests (3): greets_sam different_names_differ greets_anyone

This exercise runs real Rust in your browser through the official Rust Playground, so it needs JavaScript.

What you have now

Chapter 1 is done. You know what a program is, how to make and run a Rust project, how to print text with holes, how to leave comments, and how to read your first compiler error. Chatterbox greets you by name.

Next, chapter 2: giving values names so Chatterbox does not repeat itself.

Self-check

Say it out loud, then reveal

Self-checkRetrieval beats re-reading
What did Chatterbox gain in this lesson?Reveal
A personal greeting: it prints a banner, then a line that fills in a name.
Why is typing "Chatterbox" twice a problem?Reveal
If the name changes you have to find and edit every copy. Chapter 2 introduces names for values to fix that.

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

Next: 2.1 Names for values →
Learn Rust by building a chat app · Lesson 1.4 · every compiler message above is real output from rustc 1.99.0 (b940084d7 2026-09-28) (edition 2024) · Vibe Engines · 2026