By the end of this lesson
Separate source code, the compiler and the executable, then print a greeting.
Before you start
- Rust 1.90.0 or later, a terminal and a plain-text editor. Examples were tested with Rust 1.90.0, Edition 2024 on Linux.
- No previous Rust experience is needed.
Three words to know
- Compiler
- A program that checks source and builds an executable.
- Executable
- The compiled program that your operating system runs.
- Toolchain
- The compiler and supporting tools for a Rust release.
1. Understand the idea
Rust normally compiles before it runs. A .rs file is text; editing it does not update an executable you already built. rustc reads the saved source, checks it, then creates a separate binary. main is the entry point. println! is a macro that writes a line; its exclamation mark is part of the syntax. A VPS is optional: start on your own computer.
Install using the official Rust installation page for your operating system. Linux/macOS use rustup; Windows usually needs the MSVC C++ build tools described there. Read the installer prompts and restart your terminal if commands are not found. On Ubuntu a linker may require the build-essential package; do not assume the distribution rustc package is the same version as rustup.
rustc --version
cargo --versionWhat you should see · example output
The commands print installed versions; exact build identifiers vary.
2. Save, run and observe
Save this complete program as lesson.rs in a fresh practice folder. It replaces that lesson file only; keep earlier examples separately. Compile it with rustc, then run the executable. Rust source goes in the editor; rustc and cargo commands go in the terminal.
fn main() {
println!("Hello, OpenViST!");
}
What you should see · example output
Hello, OpenViST!
rustc --edition=2024 lesson.rs -o lesson
./lesson3. Explain the result
The braces contain the body of main. The string inside quotation marks is data, not a terminal command. The semicolon ends the println! statement. After changing the greeting, compile again before running; otherwise you may run the old executable. There is no browser, API call or remote server in this example.
YOUR TURN
A small check before you continue
Change the greeting to Hello, learner! Which two steps are needed after saving?
Show a suggested answer
Compile lesson.rs again, then run the new executable. The output is Hello, learner! followed by a newline.
Sources and scope
Documentation and examples reviewed 2026-10-18. Provider screens, package versions and output wording can differ. Examples show expected outcomes; they are not a claim that OpenViST connected to your server or verified your setup.
