Array size after initialization

Hi. How i can set array size after initialization?

Arrays can’t be resized:

let x = [10, 20, 30];
// x will always have 3 items    

Vectors can, however:

let mut x = vec![10, 20, 30];
x.push(40);
assert_eq!(x.len(), 4);
x.resize(10, 0);
assert_eq!(x.len(), 10);
4 Likes