playing with the mutable references

This commit is contained in:
Vincent Batts 2023-01-14 14:44:18 -05:00
parent 62b4865c9c
commit 0a2003dfc8
21 changed files with 6 additions and 1 deletions

View File

@ -9,8 +9,13 @@ fn main() {
println!("t 2nd: {}", t.1);
let mut x: i32 = 10;
let mut z: i32 = 5;
println!("x: {x}");
let ref_x: &mut i32 = &mut x;
println!("z: {z}");
let mut ref_x: &mut i32 = &mut x;
*ref_x = 20;
println!("x: {x}");
ref_x = &mut z;
*ref_x = 20;
println!("z: {z}");
}

Binary file not shown.