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 match a URL with a regex in Rust?
- How to match whitespace with a regex in Rust?
- How to replace a capture group using Rust regex?
- How to convert struct to JSON string in Rust?
- How to get an entry from a HashSet in Rust?
- How to create a slice from a string in Rust?
- How do I print the type of a variable in Rust?
- How to write struct to file in Rust
- Pointer comparison in Rust
- How to replace all matches using Rust regex?
See more codes...