mirror of
https://github.com/rust-lang/rustlings.git
synced 2025-01-14 00:00:02 +03:00
15 lines
250 B
Rust
15 lines
250 B
Rust
fn main() {
|
|
let mut counter = 0;
|
|
|
|
let mut increment = || {
|
|
counter += 1;
|
|
println!("counter equals {}", counter);
|
|
};
|
|
|
|
increment();
|
|
increment();
|
|
let _reborrowed_counter = &counter;
|
|
|
|
assert_eq!(counter, 2);
|
|
}
|