One of the most important concepts in modern programming is Exceptions. The simple concept is this: When some kind of error occurs during runtime, the execution will terminate and an Exception will be thrown. This will cause the stack to unwind until an appropriate Exception Handler is found. When Foo is called, it invokes GetItem This tries to access item -1 in an array.
TryCatchFinally statement - Visual Basic | Microsoft Docs
The meaning of the first statement is this: if you get an error, ignore it and resume execution on the next statement. The odd syntax is because Visual Basic has an error handling mode which VBScript does not — VB can branch to a labeled or numbered statement. This is because the error mode is on a per-procedure basis, not a global basis. Consider these two scripts:. They do not have the same semantics. If Foo.
Join Stack Overflow to learn, share knowledge, and build your career. Connect and share knowledge within a single location that is structured and easy to search. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more.
This lesson is part of an ongoing tutorial. The previous part is here: Runtime Errors. NET has a inbuilt class that deals with errors.