Values & References8 / 18
Up next

Mutable borrow

// &mut Vec lets the function modify the caller's data
fn push_zero(v: &mut Vec<i32>) {
    v.push(0);
}

fn main() {
    let mut nums = vec![1, 2];
    push_zero(&mut nums);
    println!("{:?}", nums);
}
What you're solving

&mut lets the callee change your value