I have the task to refactor an iOS app to Swift 3. However, there is a for loop, in C-style, that does more than just looping an array backwards (it\'s mandatory to
Everybody here is very unnecessarily complicating this.
let words = ["hello", "world", nil, "foo", nil, "bar", "Peter Griffin"]
var num3LetterWords = 0
for word in words.reversed() {
if (word?.characters.count == 3) { num3LetterWords += 1 }
}
print(num3LetterWords)