9951 explained code solutions for 126 technologies


rustRust Hello World example


This is a simple example of a "Hello World" program written in Rust.

fn main() {
    println!("Hello, world!");
}

Output example

Hello, world!

The code consists of two parts:

  1. The fn main() function: This is the entry point of the program. All Rust programs must have a main function.

  2. The println! macro: This macro prints a string to the console. The ! indicates that it is a macro, not a function.

Helpful links

Edit this code on GitHub