loading...

Discussion on: Look ma', without loops!

Collapse
chrisvasqm profile image
Christian Vasquez Author

Hmmm 🤔

I'll check it out and update the post!

EDIT:

You are totally right 😲

The filter way:

val belowAverage = students.filter { it.score < average }.size

The count way:

val belowAverage = students.count { it.score < average }

🎉🎉🎉