forEach(_:)
It's an instance method that calls the given closure on each element in the sequence in the same order as a for-in loop.
Declaration
func forEach(_ body: (Element) throws -> Void) rethrows
Where body = A closure that takes an element of the sequence as a parameter.
Example
let numberWords = ["one", "two", "three"]
numberWords.forEach { word in
print(word)
}
//Output
one
two
three
basics forEach loop