...

/

Untitled Masterpiece

This lesson gives a detailed solution review to the problem in the previous lesson.

Solution:

Rust 1.40.0
fn arr_square() -> [i32;5] {
let mut square:[i32;5] = [1, 2, 3, 4, 5]; // mutable array
for i in 0..5 { // compute the square of each element
square[i] = square[i] * square[i];
}
square
}
fn main(){
println!("Updated Array : {:?}",arr_square());
}

Explanation

  • On line 2, a mutable array square of type
...