fn main() {
let mut numbers = vec![1, 2, 3];
// Extend the vector to length 5, filling with 0
numbers.resize(5, 0);
println!("{:?}", numbers); // Output: [1, 2, 3, 0, 0]
// Shrink the vector to length 2
numbers.resize(2, 0);
println!("{:?}", numbers); // Output: [1, 2]
}
/*
run:
[1, 2, 3, 0, 0]
[1, 2]
*/