I have a function which takes inout argument
func modify(word: inout Word)
I need to call it on each element of array. Here is what I do
for word in words {
modify(word: &word)
}
But I get error:
cannot pass immutable value as inout argument: 'word' is a 'let' constant
I tried to iterate through map words.map{ modify(word:&$0) }, still the same error:
cannot pass immutable value as inout argument: '0$' is immutable
Is there any way to call a function with an inout argument on each element of array?