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 convert the keys of a Rust HashMap to a vector?
- How to match whitespace with a regex in Rust?
- How to get the length of a Rust HashMap?
- How to match a URL with a regex in Rust?
- How to replace a capture group using Rust regex?
- How to replace all matches using Rust regex?
- How to parse a file with Rust regex?
- Bitwise XOR operator usage in Rust
- How to replace strings using Rust regex?
- How do I identify unused variables in Rust?
See more codes...