mirror of
https://github.com/ahgamut/rust-ape-example.git
synced 2024-11-21 23:41:00 +00:00
23 lines
376 B
Rust
23 lines
376 B
Rust
// ./src/variable_bindings/mut.md
|
|
|
|
|
|
fn part0() {
|
|
let _immutable_binding = 1;
|
|
let mut mutable_binding = 1;
|
|
|
|
println!("Before mutation: {}", mutable_binding);
|
|
|
|
// Ok
|
|
mutable_binding += 1;
|
|
|
|
println!("After mutation: {}", mutable_binding);
|
|
|
|
// Error!
|
|
// _immutable_binding += 1;
|
|
// FIXME ^ Comment out this line
|
|
}
|
|
|
|
pub fn main() {
|
|
part0();
|
|
}
|
|
|