Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Loop with a sum
let nums = [1, 2, 3, 6, 16, 4]
var sum = 0
for var i in (0..<nums.count) {
sum += nums[i]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment