Fix a bug

Report a typo

Make the following code work using one of the two discussed solutions.

Write a program in Kotlin
class Article(val name: String, val pages: Int, val author: String)

fun getArticleByName(articles: MutableList<Article>, name: String): Article? {
var index = -1
for ((title, pages, author) in articles) {
index += 1
if (title == name) return articles[index]
}
return null
}
___

Create a free account to access the full topic