Run your first Rust program
Print output and meet Rust’s compile-then-run workflow.
- Compile and run a simple Rust program that prints text.
Rust is a systems language built for performance and reliability. The compiler checks many bugs before your code runs. println! is a macro that prints text followed by a newline.
fn main() {
println!("Hello, Rust!");
}Hello, Rust!
Rust’s strict compiler is a teaching tool: error messages explain what failed and often suggest fixes. This track follows stable Rust patterns and beginner-friendly idioms.
Key takeaways
Compile and run a simple Rust program that prints text.
Rust uses types and ownership rules to prevent common bugs.
Small experiments build intuition quickly.
Lesson quiz
5 questions · pass with 4 correct · up to 50 XP
Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.
Practice: write Rust
These run for real. Write the program, press Run tests, and read what the compiler tells you - learning to read compiler messages is half of learning C.
Print a welcome line
Print exactly Welcome to Rust! on one line.
- Welcome line
Rust lessons are authored for modern stable Rust; exercises run on Rust 1.82 via Wandbox, a free public service. Your source code and test input are sent to that service.
Questions about this lesson
Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.
Loading posts…