Rust arrays are not mutable
- By default arrays are not mutable and thus we cannot change a value.
- This example has a compilation error.
fn main() {
let numbers: [i32; 3] = [10, 11, 12];
println!("{:?}", numbers);
numbers[0] = 30; // cannot assign to `numbers[_]`, as `numbers` is not declared as mutable
println!("{:?}", numbers);
}