Rust Hello, world!

Hello, world! is often the first program that we write in a new programming language. It helps us to understand the most basic application syntax and is a good way to test our tool chain to make sure that we can compile and/or run a program.

HelloWorld.rs
//
// Simple first program.
//

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

Using a programming text editor paste the source code above into a new document and save it with the name listed above. A binary must then be generated from the source code using the Rust compiler.

> rustc HelloWorld.rs

If our program compiles with no errors we can then run the executable file created.

> ./HelloWorld
Hello World!