Deviopath › Swift

Sum of an Array

Easy · Collections

[Int] is an array of integers. for n in numbers visits each, or use numbers.reduce(0, +). Empty arrays sum to 0.

Write total(_:).

Next: Contains