September Morn Update

This commit is contained in:
Ingy döt Net 2019-09-12 10:33:56 -07:00
parent 4e2d22a71d
commit aac6731f2c
6856 changed files with 141342 additions and 21127 deletions

View file

@ -1,12 +1,9 @@
result = DetectDividebyZero(1, 0)
Function DetectDividebyZero(a, b)
On Error GoTo [Error]
DetectDividebyZero= (a/ b)
Exit Function
[Error]
If Err = 11 Then '11 is the error number raised when divide by zero occurs
Notice "Divide by Zero Detected!"
End If
End Function
100 WHEN EXCEPTION USE ERROR
110 FOR I=5 TO-2 STEP-1
120 PRINT 10/I
130 NEXT
140 END WHEN
150 HANDLER ERROR
160 IF EXTYPE=3001 THEN PRINT EXSTRING$(EXTYPE);" in line";EXLINE
170 CONTINUE
180 END HANDLER

View file

@ -1,6 +1,12 @@
10 ON ERROR GOTO 60
20 PRINT 2/3
30 PRINT 3/5
40 PRINT 4/0
50 END
60 IF ERR=11 THEN PRINT "Division by zero in line"ERL:RESUME 50
result = DetectDividebyZero(1, 0)
Function DetectDividebyZero(a, b)
On Error GoTo [Error]
DetectDividebyZero= (a/ b)
Exit Function
[Error]
If Err = 11 Then '11 is the error number raised when divide by zero occurs
Notice "Divide by Zero Detected!"
End If
End Function

View file

@ -1,13 +1,6 @@
;Set up a Procedure to handle any Error
Procedure MyErrorHandler()
Define txt$="The following error happened."+#CRLF$+ ErrorMessage()+"at line "+Str(ErrorLine())
MessageRequester("OnError test", txt$)
EndProcedure
; Tell where to go if an Error happens
OnErrorCall(@MyErrorHandler())
;Now, do something very stupid so that we may see an Error...
Repeat
A=Random(100)/Random(100)
ForEver
10 ON ERROR GOTO 60
20 PRINT 2/3
30 PRINT 3/5
40 PRINT 4/0
50 END
60 IF ERR=11 THEN PRINT "Division by zero in line"ERL:RESUME 50

View file

@ -1,2 +1,13 @@
Define.d a, b
Debug a/b
;Set up a Procedure to handle any Error
Procedure MyErrorHandler()
Define txt$="The following error happened."+#CRLF$+ ErrorMessage()+"at line "+Str(ErrorLine())
MessageRequester("OnError test", txt$)
EndProcedure
; Tell where to go if an Error happens
OnErrorCall(@MyErrorHandler())
;Now, do something very stupid so that we may see an Error...
Repeat
A=Random(100)/Random(100)
ForEver

View file

@ -1,7 +1,2 @@
on error goto [error]
a = 1 / 0
wait
[error] ' error 11 is division by zero err number
If err = 11 Then print "Division by Zero"
wait
Define.d a, b
Debug a/b

View file

@ -0,0 +1,7 @@
on error goto [error]
a = 1 / 0
wait
[error] ' error 11 is division by zero err number
If err = 11 Then print "Division by Zero"
wait