Link Search Menu Expand Document

Challenge 2 - Return an Array of Squares

  • Problem Statement The task is to modify the given function arr_square() to use loops to iterate over an array and replace all of its elements by their squares.
  • Output The function should return the following array: ``` [1, 4, 9, 16, 25]

# Coding Exercise 

fn arr_square() -> [i32;5] { // Write code here! [0, 0, 0, 0, 0] }

```

Good luck! 🤞