rust-ape-example/src/bin/variable_bindings_mut.rs

24 lines
376 B
Rust
Raw Normal View History

// ./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!
2022-09-07 05:36:14 +00:00
// _immutable_binding += 1;
// FIXME ^ Comment out this line
}
pub fn main() {
part0();
}