Hello World program in Rust
In this section, we are going to install the Rust programming language and write a basic program that prints "Hello World!"
What is an "Hello World" program ?
Put simple, it is writing a program that prints "Hello world" (or "Hello, world!"). It's like some sort of ritual in the board programming community to welcome yourself; just like a baby's first cry.
Installing the Rust programming language toolchain.
See the Rust programming language toolchain installation guide here https://www.rust-lang.org/tools/install
Writing Hello world in Rust
Step one: Create a new hello_world.rs
file
touch hello_world.rs
Step two: Add the code below to your hello_world.rs
file
fn main() { println!("Hello, world!"); }
Step three
- For Windows Operating system
rustc hello_world.rs -o hello
./hello.exe
- For Linux and Mac
rustc hello_world.rs -o hello
./hello