The RUST Language

Hello World!


Rust is a system programming language with the goals Safety, Speed and Concurrency. Rust is good in embedding with other languages. It has a number of compile time safety checks that eliminates the data races.

How to install?

For Linux and Mac, open the terminal and enter the following command.

$ curl -sSf | sh

For Windows, download and install this file.

To verify whether Rust is installed, enter the command

$ rustc --version


Cargo is Rust’s build system and package manager. It does three things

  • Building the code
  • Downloading the Dependencies and Libraries
  • Building the Libraries

We can check whether cargo is installed by typing

$ cargo — version

Hello World — Rust Program

Now let us write a Rust program that prints the text “Hello World!”

  • First, move to the destination where to write the program. For example /home/User/Documents/RUST.
  • Now open the terminal and type
cargo new hello_world --bin
Creating new Cargo

When we list the files in hello_world it will have Cargo.toml and src directory.

In the src directory we have the, in which we write the code. In Cargo.toml, we give the dependencies.

  • Let’s write the code for “Hello World” program. For that, we need to open the file in an editor. I use nano editor, that is accessible in the Linux terminal. Write the code and save the file.
$ nano src/
Rust code for Hello World!

Here, fn keyword denoted the function declaration and main() is the main function.

The println!() method is used to print the values to the output console.

Now, let us build and run the code. The command used to build the code is

$ cargo build

The command to run the code is

$ cargo run
Output of Hello World program

Now, we have installed Rust in our system and executed a simple Hello World program in Rust. Since this is a very simple program and need no dependencies, we left the Cargo.toml unchanged.

Looking forward for your valuable feedbacks and suggestions.

Thank you!!