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 amainfunction. -
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 get struct length in Rust
- How to replace strings using Rust regex?
- How to match whitespace with a regex in Rust?
- How to do a for loop with index in Rust
- How to use regex lookahead in Rust?
- How to use regex to match a double quote in Rust?
- How to add matrices in Rust?
- How to compare two Rust HashMaps?
- Rust negative for loop example
- How to implement PartialEq for a Rust HashMap?
See more codes...