OT: BASIC (was Re: On Error GoTo 0 ???) 
Author Message
 OT: BASIC (was Re: On Error GoTo 0 ???)


Quote:
>Re: On Error GoTo 0 ???This horrific artifact changes the way that VBScript
>responds to error events.
>To TURN OFF error checking/events, use

>On Error Resume Next

>This forces VBS to ignore normal error event processing, and simply executes
the
>next VB line of code, allowing you to handle error conditions yourself.
>Generally done by testing function result codes, or (cringe) testing objects
>'nothing-ness', i.e.

>If objSpam Is Nothing

>this is a evil throw-back to function-style programming.

>To turn error checking BACK ON, you use

>On error GoTo 0

>which causes WSH to issue normal error messages when something breaks.

>I'm sure this construct has its noble roots in PC-BASIC or some-such.

Even earlier than that. I learned BASIC on a PDP-11 in 1976. Every line of code
had a line number (if you didn't type the line number, the code was executed
immediately). Variable names were a single letter or a letter and a digit;
string variables had a trailing "$". There were no functions. There was a GOSUB
command, but it just pushed the current line onto the stack and jumped to the
line number specified (GOSUB 1000); there was no argument list--all variables
were global. The RETURN statement just popped the line number off the stack and
resumed execution.

Error trapping was accomplished by using the ON ERROR GOTO line# statement. An
error would jump to the line specified and run until there was a RESUME
(re-execute the statement that caused the error) or RESUME NEXT (resume at the
line after the one that caused the error).

Since 0 was an invalid line number for a BASIC program, ON ERROR GOTO 0 was used
to turn off error trapping. I don't believe there was an ON ERROR RESUME NEXT
statement, but you could always set the ON ERROR GOTO to execute a RESUME NEXT
statement.

We now warp back to the present 8-)

Steve Fulton



Sun, 16 Dec 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Freeware and Software in Visual Basic 6.0 (OT)

2. Compilation error: On Error Goto...Syntax

3. on error goto 0 in VBScript

4. On Error GoTo?

5. On Error Goto

6. On Error Goto Label

7. VBScript/ASP - Help with On Error Goto

8. On Error GoTo 0 ???

9. Using On Error Goto

10. What does - On Error goto 0 - mean?

11. OT?: Winbatch exit error

12. I am getting errors I can't pin down

 

 
Powered by phpBB® Forum Software