Hello World Program in Rust
In this tutorial, we will learn how to write a Hello World program in Rust language. We will go through each statement of the program.
Rust Program
fn main() {
println!("Hello, World!");
}
Output
Hello, World!
Working of the "Hello, World!" Program
fn main()
This line defines the main function where the program execution begins. In Rust,fn
is used to declare a function.{
This opening brace marks the beginning of the main function's body.println!("Hello, World!");
This line prints the string "Hello, World!" to the standard output (usually the screen). Theprintln!
macro is used for printing text to the console in Rust.}
This closing brace marks the end of the main function's body.