Hello World
Hello, World!
fn main() {
println!("Hello, world!");
}fn means function. main function is the beginning of every Rust program.
println! prints text to the console and its ! indicate that it’s a macro instead of a function.
💡 Rust files should have .rs file extension and if you’re using more than one word for the file name, follow the snake_case.
Save above code in
file.rs, but it can be any name with.rsextension.Compiling via
rustc file.rsExecuting by
./fileon Linux and Mac orfile.exeon Windows
Rust Playground
Rust Playground is a web interface for running Rust code.

Usages of println!
💯 These are the other usages of println! macro,
Last updated