summaryrefslogtreecommitdiff
path: root/References are also immutable by default.md
blob: f434b63b3fb4c91096791a80b0dcd45189d65389 (plain)
1
2
3
4
5
[[Rust]]

---

Because references are also immutable by default, if we would declare a variable mutable such as `let mut guess = String::new();` and we were to pass a references to guess to another function, we must place the `mut` keyword there as well as such: `read_line(&mut guess)` rather than just `read_line(&guess)`.