Hello. I need help programming a project that needs to be able to get several numerical inputs from a user and do several mathematical operations on the input and then print the result.
This has to be done using a function but I get input by doing this:
var answer = readLine()
and then into my function that looks like this:
func SumNumbers (_ numbers:Double...){
var sum: Double = 0
for each in numbers{
sum += each
}
print("the sum of your numbers is (sum)")
}
then i try to put the var answer and answer 2 which works the same as answer into it and it says it needs to be a number and not a string