October 2025
Intermediate to advanced
100 pages
2h 27m
English
| Puzzle 12 | It’s over Nine Thousand! |
| | data class Hero(val power: Int) |
| | |
| | fun main() { |
| | val heroes: List<Hero> = emptyList() |
| | |
| | val overEightThousand: Boolean = heroes.any { it.power > 8000 } |
| | val overNineThousand: Boolean = heroes.all { it.power > 9000 } |
| | |
| | println("Any > 8000: $overEightThousand") |
| | println("All > 9000: $overNineThousand") |
| | } |
Guess the Output | |
|---|---|
|
|
Try to guess the output (or error) before moving to the next page. |
The program displays the following output:
| | Any > 8000: false |
| | All > 9000: true |
Read now
Unlock full access