I recently started learning to code and I am encountering an issue with appending a string that has been turned into a variable into an array. Here is what the console said:
cannot convert value of type '[String]' to expected argument type 'String'
Here is my code:
var randomList = [String]()
func getList(inputList:Array<String>) -> Array<String>{
randomList = inputList
return randomList
}
func addItem(item: String...) -> String{
randomList.append(item)
return "\(item) was added"
}
func getItem(x: Int) -> String{
return randomList[x]
}