Hello World!
Print the text Hello World! using the println! function.
fn main() { println!("Hello World!"); }
Save the code in a file named hello.rs.
To build the Rust file, use the command below. It creates an executable named hello.
rustc hello.rs
To run the executable on Linux or macOS, use the command below.
./hello
This command prints Hello World!.