Skip to content

Latest commit

 

History

History
30 lines (19 loc) · 670 Bytes

File metadata and controls

30 lines (19 loc) · 670 Bytes

Any callback

Nice to solve before

Instructions

Given list of integers and callback implement a recursive function which returns true if simple value in the list passed to callback returns true, otherwise return false.

challenge | solution

Examples

Example 1

val callback:((Int) -> Boolean) = { it > 3 }
anyCallback(listOf(1, 2, 3, 4), callback) shouldBeEqualTo true

Example 2

val callback:((Int) -> Boolean) = { it > 3 }
anyCallback(listOf(1, 2, 3), callback) shouldBeEqualTo false