Borrowing

let mut foo = 4;
let mut borrowed\_foo = &foo;
println!("{borrowed\_foo}");

let mut bar = 3;
let mut mutable\_borrowed\_bar = &mut bar;
println!("{mutable\_borrowed\_bar}");

Here borrowed value borrows the value from value one using & operator.

Comments