# Working Document for Rust Learning! ### **Variables & Mutability** ```rust // immutable by default let x = 5; // mutable variable let mut x = 5; x = 6; ``` #mutable and #immutable in rust are two ways to define a variable in rust. An **immutable** variable, rust's default, can not be changed at all once it is declared and instantiated. A **mutable** variable can be changed after it is declared and instantiated ### **Constants** Like **immutable** variables, #constants in rust are bound to their name and the value assigned. ```rust const THREE_HOURS_IN_SECONDS: u32 = 60 * 60 * 3; ``` **Constants** are however: - Only **immutable** - use `const` keyword not `let` - must be **type annotated** - can be declared in any scope, **even the global scope** - powerful for information you want a full project to know about! - can only be the result of **constant expressions** - not the result of a value that is computed at **runtime** Compiler is able to evaluate some expressions at compile time, like the above multiplication expression. [Full List of Expression](https://doc.rust-lang.org/reference/const_eval.html) that can be evaluated at compile time., *Conventions* - [x] *All upper-case* - [x] *Words separated by `_`* ### **Shadowing** You can declare variables with the same name as the previous variable! ```rust let x = 5; let x = "string"; ```