mirror of
https://github.com/ahgamut/rust-ape-example.git
synced 2024-11-25 17:21:05 +00:00
24 lines
373 B
Rust
24 lines
373 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();
|
||
|
}
|
||
|
|