Kotlin & Coroutines (50 Qs)•Part 3: K2 Compiler, KMP, Advanced Metaprogramming & Optimization (25 - 35)
What is runCatching and Result<T> in Kotlin and how does it compare to try-catch?
senior LevelPerformance
In Simple Words:
runCatching { ... } executes a block and encapsulates the outcome into an inline Result<T> value. It enables functional chaining via map, recover, and onFailure without throwing unhandled exceptions.