Quote:
|
Actually try-catch-finally block is used to catch any errors/exceptions. It prevents your application from terminating unexpectedly and allows you to handle the errors.
|
That's pretty much it in a nutshell. Another specific use not mentioned that I like to apply try..catch(try..except) blocks for is datatype checking. eg:
try
casttosomething(variable)
except
messagebox(invalid datatype, please enter a valid type)
end
Something like that checks to make sure a user input was a valid type, quite useful for data integrity.