Rust Hello World Program

In this tutorial you will learn about the Rust Hello World Program and its application with practical example.

Rust Hello World Program

As usual we will start learning Rust programming by creating “Hello, world!” program. The “Hello, world!” program is a simplest program that will display some text on the screen. The “Hello, world!” program is a simple yet complete program for beginners that illustrates the basic syntax of Rust programming language. The “Hello, world!” program gives you a way to test systems and programming environment.

This tutorial will guide you through writing a basic “Hello, World!” program in Rust.

Creating Hello World Program

Step 1:- Create a file called “hello.rs” using a text editor program of your choice. The .rs file extension is used to specify Rust file.

Step 2:- Let’s open the “hello.rs” file that we created, and put the following line of code in it and save it.

The println() is a Rust macro that emits formatted text to the console.

Step 3:- Now, open terminal or command prompt and switch to the folder where our “hello.rs” file is saved. Now, compile the program by typing the following command –

Rust Hello World Program

Step 4 :- After the program is complied, we can run using the filename.exe

Now, when the program is executed it will print “Hello, world!” as below –

Rust Hello World Program

Output:-

Recommended:-  Rust Error Handling
In this tutorial we have learn about the Rust Hello World Program and its application with practical example. I hope you will like this tutorial.