try, catch and finally
Handle exceptions with on and catch. finally always runs.
Example
try {
int.parse("abc");
} on FormatException catch (e) {
print("bad number");
} finally {
print("done");
}Exercise
Always runs.
try {} {}
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.