Arrays are a fundamental data structure in Rust that allow you to store a fixed-size collection of elements of the same type. A common operation is to calculate the sum of all elements in an array.

In this challenge, you will implement a function to calculate the sum of elements in an array of integers i32.

Use the .iter() method to iterate over the elements of the array.

Use the .sum() method to calculate the sum of the elements.

Editor not available on Mobile!

In order to solve the challenge, please visit this page on a desktop computer.

Sum of Array

Arrays are a fundamental data structure in Rust that allow you to store a fixed-size collection of elements of the same type. A common operation is to calculate the sum of all elements in an array.

In this challenge, you will implement a function to calculate the sum of elements in an array of integers i32.