Anatomy of Rust Program

Let's look at the following codes that prints out "Hello, world!",

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

The main function is special: it is always the first code that runs in every executable Rust program. Here, the first line declares a function named main that has no parameters and returns nothing. If there were parameters, they would go inside the parentheses ().