fn main() {
println!("Hello world!")
}
rustc FILE_NAME.rs
rs
extentioncargo build
cargo build --release
cargo run
cargo check
cargo update
//
String::new()
// without type annotation
let cars = 2;
// with type annotation
let cars: i32 = 2;
// multiple variables
let (cars, trucks) = (2,4);
// make variable mutable by adding 'mut' keyword before variable name
let mut cars = 2;
const PI: f64: 3.14
const
keyword is used to define constant variable which can be used across module scope, which is defined outside the functions