Which function is used to iterate over a collection in Kotlin?
iterate()
forEach()
loop()
foreach()
(B) forEach()
Explanation:
The forEach() function in Kotlin is used to iterate over a collection or array and execute a block of code for each element.