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
  • 141,339
  • 29
  • 256
  • 279
JerryZhou
  • 4,045
  • 3
  • 31
  • 54

0 Answers0