What is programming?
Quick answer
Programming means describing a task as instructions a computer can execute. A Rust source file contains instructions written in the Rust language. A compiler translates those instructions into a program. Start with a simple task: displaying a useful message.
Instructions and order
An algorithm is a finite sequence of steps for solving a problem. In these examples fn main() marks where execution starts and println! displays a line. Each instruction ends with a semicolon. Read the lines from top to bottom.
Expected stdout (not executed):
Welcome to the library!The message between double quotes is displayed without the quotes.
fn main() { println!("Open the book"); println!("Read one page"); println!("Close the book");}Expected stdout (not executed):
Open the bookRead one pageClose the bookEach line represents a separate step, in the order written.
Common mistake
A computer cannot infer a missing step just because a person understands the goal. Write down the steps explicitly.
Try it yourself
Write three instructions for preparing a school bag, then change their order and predict the display.
Static examples for Rust 1.85.0, edition 2024. Run them locally in a disposable project; ByteMind execution support and these outputs have not been verified.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
What is programming? — practice quiz
Choose one answer per question, then review the explanation.
Which instruction sequence prepares a cup of tea in a sensible order?
Inside main, what appears first if `println!("Pack"); println!("Leave");` runs?
A program prints "Water" but the intended recipe also needs "Salt". What change adds the missing instruction?