You need it in try also then. And btw just an example. What if you need to execute more than 1 statement after the process. I cant copy paste in both try and catch block.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
In
finally
block you can perform things in all the cases. An error occurs or not thefinally
is executed. Ex., Turn offloading
.yes, but you actually don't need the
finally
block for that. you can callsetLoading(false)
directly below thecatch
block.do you think it looks just better? or is more clear?
You need it in try also then. And btw just an example. What if you need to execute more than 1 statement after the process. I cant copy paste in both try and catch block.