Im instantiating a mutable array, but it seems the elements become immutable so that I cant pass references to them to my function.
ERROR: "Cannot pass immutable value as inout argument: 'word' is a 'let' constant"
// MARK: - Properties
var wordsToTest = ["hannah", "bam"]
// MARK: - Life cycle
override func viewDidLoad() {
super.viewDidLoad()
for word in wordsToTest {
print("\(word) is a palindrome - ", isPalindrome(&word))
}
}
How can I go about and fix it?
isPalindromefunction. There is no reason why it should take aninoutparameter. Change that function and don't worry about array being a constant. - Sulthan