EDIT I changed it according to some suggestions but I am now getting different errors
I'm trying to write a function that reads an array and if the number of elements is less than 10, then it continues to add generated values into it.
To do so I made this function:
func arrayValueInputter(w : Array<Int>){
var x = 0;
repeat{
x += 2;
w.append(x);
} while w.count < 10
print(w);
}
arrayValueInputter([1, 3, 9, 10]);
print("End Here");
However everytime I run it I get the error:
OLD ERROR
error: extraneous argument label 'w:' in call
arrayValueInputter(w: [1, 3, 9, 10]);
OLD ERROR
NEW ERROR
Untitled-2.swift:12:5: error: cannot use mutating member on immutable value:
'w' is a 'let' constant
w.append(x);
^
Untitled-2.swift:20:20: error: missing argument label 'w:' in call
arrayValueInputter(&arr);
NEW ERROR
I don't know what I'm missing or maybe I'm using the loop wrong. Since, I just started learning swift.