`let mut` — Opting Into Mutability - Day 07
Yesterday we saw that let gives you an immutable binding. But sometimes you genuinely need a variable to change — a counter, a running total, a buffer being filled. For that, you use let mut. The syntax let mut count = 0; count += 1; count += 1; println!("{}", count); // 2 Adding mut tells both the compiler and the reader: this value is intentionally going to change. Why does the distinction matter? It’s a communication tool. When you see let in Rust code, you immediately know: this value won’t change. When you see let mut, you know to pay closer attention — something is being mutated here. ...