I've read the kotlin documentation and tried BooleanArray.count(predicate: (Boolean) -> Boolean)
, but it still returns the size of the array
, not the number of true
:
val checks = arrayOf(true, false, true, true, true)
val trueCount = checks.count { true }
What's wrong with my code?