- Invoke the parseInt() function in the try…catch declaration:
try {
parseInt("fdsaa")
} catch (e: NumberFormatException) {
0
}
- Assign the result of the try…catch declaration to the value variable:
val result = try {
parseInt("fdsaa")
} catch (e: NumberFormatException) {
0
}