0
func sumOf(numbers: Int...) -> Int {
    var result = 0
    for number in numbers {
        result += number
    }
    return result
}

let a1 = sumOf(numbers: 1, 2, 4, 10)

func sampleOfSum(nums: Int...) -> Int {
    return sumOf(numbers: nums)// Error: Cannot convert value of type '[Int]' to expected argument type 'Int'
}
vacawama
  • 150,663
  • 30
  • 266
  • 294
JerryZhou
  • 4,566
  • 3
  • 37
  • 60

0 Answers0