public fun <T> Iterable<T>.any(): Boolean {
for (element in this) return true
return false
}
val list = listOf(1, 2, 3, 4, 5)
println(list.any()) // true
val emptyList = listOf<Int>()
println(emptyList.any()) // false
public inline fun <T> Iterable<T>.any(predicate: (T) -> Boolean): Boolean {
for (element in this) if (predicate(element)) return true
return false
}
val list = listOf(1, 2, 3, 4, 5)
println(list.any{ it > 3 }) // true
println(list.any{ it > 0 }) // true
println(list.any{ it > 5 }) // false