try...catch...finally
We can add one more construct to try...catch
called finally
, this code executes in all cases. i.e. after try
when there is no error and after a catch
in case of error. The syntax for try ...catch...finally
is shown below.
Running real-world example code.
In the above example, the try
block is executed first which is then followed by finally
as there are no errors.
Last updated
Was this helpful?