Rust Daily Learning - Day 1
Overview
Welcome to the Rust daily learning series! In this series, we will explore the Rust programming language in a systematic manner. Today, we will focus on installing Rust and compiling a basic program, namely the “Hello, World!” program.
Installation
- Navigate to the Rust official website.
- Follow the installation instructions for your specific operating system.
- Once the installation is complete, restart your terminal and run the following command:
rustc --version
. - If the installation was successful, you will see the Rust compiler version. If not, check your environment variables and try again.
Hello World
- Create a new file named
hello_world.rs
. - Insert the following code into the file:
fn main() {
println!("Hello, world!");
}
- Save the file and navigate to the file’s directory using the terminal.
- Run the following command to compile the program:
rustc hello_world.rs
. - Execute the generated binary file (e.g.,
./hello_world
on Unix-based systems). - If the output displays “Hello, world!”, your program has successfully compiled and executed.
Stay tuned for the next installment in this series, where we will delve into Rust’s basic syntax and explore its unique features. Continue learning and discover the power of Rust!