Understanding Variables in Rust
This guide introduces variables in Rust, explaining the let keyword and how to use it to declare mutable and immutable variables.
Variable Declaration in Rust
Variables in Rust are declared using the let keyword. To make a variable mutable, add mut:
// Declaring variables in Rust
let name = "Rust"; // Immutable
let mut age = 3; // Mutable
age = 4; // Allowed since it's mutable
×