ON ERROR GOTO label |
ON ERROR GOTO label
Go to specified label when an error occurs
Example:
' Global Error handler ON ERROR GOTO _ERROR
SUB Kalle( BYVAL n AS INTEGER ) ON ERROR GOTO _KALLE PRINT n;" - Hello, my name is Kalle" ERROR 51 END SUB
FOR i = 1 TO 2 IF i > 0 THEN CALL Kalle( i ) ERROR i PRINT "%WARNING, ";ERRM, ENDIF NEXT i
END
_ERROR: PRINT "%ERROR, ";ERRM, RESUME NEXT
_KALLE: PRINT " and I'm having issues :-(", RESUME NEXT
|