October 2025
Intermediate to advanced
100 pages
2h 27m
English
| Puzzle 23 | Bringing Up the Rear |
| | fun downloadFile( |
| | onError: (String) -> Unit = { error("Missing failure callback") }, |
| | onSuccess: (String) -> Unit = { error("Missing success callback") } |
| | ) { |
| | try { |
| | onSuccess("Download successful!") |
| | } catch (error: Throwable) { |
| | onError("Something went wrong: " + error.message) |
| | } |
| | } |
| | |
| | fun main() { |
| | downloadFile { result -> println("1. $result") } |
| | downloadFile({ result -> println("2. $result") }) |
| | } |
Guess the Output | |
|---|---|
|
|
Try to guess the output (or error) before moving to the next page. |
The program displays ...
Read now
Unlock full access