Rust Hello World Program

Rust Hello World Program

In this tutorial, we will learn how to write a Hello World program in Rust language. We will go through each statement of the program.

Rust Program

fn main() {
    println!("Hello, World!");


Hello, World!

Working of the "Hello, World!" Program

  1. fn main()
    This line defines the main function where the program execution begins. In Rust, fn is used to declare a function.
  2. {
    This opening brace marks the beginning of the main function's body.
  3. println!("Hello, World!");
    This line prints the string "Hello, World!" to the standard output (usually the screen). The println! macro is used for printing text to the console in Rust.
  4. }
    This closing brace marks the end of the main function's body.