All lessons

Lesson 1 of 11

Hello, Rust

Follow your first program from the main function to the terminal.

main.rs

fn main() {    println!("Hello, Rust!");    println!("I wrote a program.");}

Program state

Program
Ready
Step 1 of 5

The program is ready to run.

What’s happening

Rust starts running your code in the main function. The braces surround its body, where you put the instructions to run.

The println! macro prints text and starts a new line. The quotes mark the text in the source code. The terminal shows the text inside them.

Read more in The Rust Book