In the code below, the function that can potentially cause an exception is called in the try block. Write the catch statement so that it prints information about this exception in the form of a message (in case it happened in the try statement).
Try-catch statement
Exception message
Report a typo
Write a program in Kotlin
// ...
try {
problemFunction()
} catch (e: Exception) {
println()
}
// ...
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.