Declare and implement a function called arrayEvenSum
that receives a one-dimensional array of
Int
values (IntArray
) as its only parameter and returns the sum of the even values in the array as an Int
.
As a reminder, you can test whether an Int
is even using the remainder operator (%
).
If the array is null
you should return 0.
Stuck? You may find these lessons helpful: