rustRust Hello World example
This is a simple example of a "Hello World" program written in Rust.
fn main() {
println!("Hello, world!");
}
Output example
Hello, world!
The code consists of two parts:
-
The
fn main()
function: This is the entry point of the program. All Rust programs must have amain
function. -
The
println!
macro: This macro prints a string to the console. The!
indicates that it is a macro, not a function.
Helpful links
Related
More of Rust
- How to replace a capture group using Rust regex?
- How to calculate the sum of a Rust slice?
- How do I create an array of strings in Rust?
- How to replace all matches using Rust regex?
- How to use regex to match a double quote in Rust?
- Hashshet example in Rust
- How to use regex captures in Rust?
- How to convert JSON to a struct in Rust?
- How to pop an element from a Rust HashMap?
- How to convert a Rust HashMap to a JSON string?
See more codes...