The TRY / CATCH construct is used if you suspect that errors may occur that you need to handle. When the
TRY command is reached it causes the code if statementBlock1 to be executed. If there are no errors generated
by statementBlock1 then the program will continue with the code immediately after ENDTRY. If errors are
detected then statementBlock2 is executed and stringVariable will contain the error string - If statementBlock2
can’t handle the error then it should re-throw the error. Errors can be generated in several ways:- File I/O,
User Generated Errors produced using the THROW keyword etc.
DIM I AS INTEGER
DIM ERR1 AS STRING
DIM ERR2 AS STRING
FOR I=1 TO 10
IF (I=5) THEN
PRINT "ERROR1> " + ERR1
THROW ERR1 + " THROWN by ERROR1"
PRINT "ERROR2> " + ERR2
PRINT "Program Finished"