[−]Keyword let
The let
keyword.
The let
keyword is used to declare a variable.
Example:
let x = 3; // We create a variable named `x` with the value `3`.Run
By default, all variables are not mutable. If you want a mutable variable,
you'll have to use the mut
keyword.
Example:
let mut x = 3; // We create a mutable variable named `x` with the value `3`. x += 4; // `x` is now equal to `7`.Run
For more information about the let
keyword, take a look at the Rust Book.