Trapping errors, Trapping errors -15 – HP 49g Graphing Calculator User Manual
Page 201
Attention! The text in this document has been recognized automatically. To view the original document, you can use the "Original mode".

« @ L o c a l v a r i a b l e S i s u s e d
@ t o s t o r e t h e s t e p n u m b e r .
@
S t e p
f r o m
1
t o
t h e
s i z e
o f
t h e
l i s t .
F O R ( S , l , S I Z E ( M A R K S ) )
@ E x t r a c t s
t h e e l e m e n t
f r o m t h e
G E T ( M A R K S , S ) ^ E
@ C o m p a r e s
i t t o t h e p a s s m a r k ,
@ r e p l a c e s
w i t h t h e n e w
v a l u e .
« I F
E > 5 0 T H E N
E + " P a s s "
► E
E L S E
E + " F a i l "
► E
E N D ;
R E P L ( M A R K S , S , { E } ) ► M A R K S
N E X T
Trapping errors
By default, a program halts when it encoimters an error. If you want
sections of your program to deal Avith errors rather than halt the program,
you need to include the sections inside error trapping structures. You can
then specify actions to take when your program encoimters errors, rather
than halting the program. The following error trapping structures are
available.
® IFERR code THEN error-code END
If the program encounters an error while it is nmning code, the remain
ing code is skipped and error-code is run. If no errors are encountered
in code, error-code is not rim.
® IFERR code THEN error-code ELSE noerror-code END
If the program encoimters an error while it is miming code, the remain
ing code is skipped and error-code is mn. If no errors are encountered
in code, noerror-code is nm.
Introduction to programming
Page 10-15