let items = [10, 20, 5324, 23, 2309]
// readable way
let total = items.reduce(0) { (result, nextValue) -> Int in
return result + nextValue
}
// encrypted way :P
let anotherTotal = items.reduce(0, { $0 + $1 })
print("Total is \(total)")
let items = [10, 20, 5324, 23, 2309]
// readable way
let total = items.reduce(0) { (result, nextValue) -> Int in
return result + nextValue
}
// encrypted way :P
let anotherTotal = items.reduce(0, { $0 + $1 })
print("Total is \(total)")