EasyManuals Logo
Home>HP>Calculator>48GII

HP 48GII User Manual

HP 48GII
653 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #59 background image
RPL Programming 1-33
Error Trapping Commands
Key Programmable
Command
Description
!° L L %ERROR% :
%DOERR%
DOERR Causes an error. For a string in level 1, causes a user-defined error: the
calculator behaves just as if an ordinary error has occurred. For a binary
integer or real number in level 1, causes the corresponding built-in error.
If the error isn't trapped in an IFERR structure, DOERR displays the
message and abandons program execution. (For 0 in level 1, abandons
execution without updating the error number or message — like .)
%ERRN%
ERNN Returns the error number, as a binary integer, of the most recent error.
Returns #0 if the error number was cleared by ERR0.
%ERRM%
ERRM Returns the error message (a string) for the most recent error. Returns
an empty string if the error number was cleared by ERR0.
%ERR0%
ERR0 Clears the last error number and message.
Making an Error Trap
You can construct an error trap with one of the following conditional structures:
! IFERR … THEN … END.
! IFERR … THEN … ELSE … END.
The IFERR … THEN … END Structure
The syntax for this structure is
!"!!67<KK!trap-clause!:;<=!error-clause!<=4!!1!
The commands in the error-clause are executed only if an error is generated during execution of the trap-clause.
If an error occurs in the trap-clause, the error is ignored, the remainder of the trap-clause is skipped, and
program execution jumps to the error-clause. If no errors occur in the trap-clause, the error-clause is skipped and
execution resumes after the END command.
To enter IFERR … THEN … END in a program:
! Press !°LL %ERROR% !%IFERR%.
Example: The following program takes any number of vectors or arrays from the stack and adds them to the
statistics matrix. However, the program stops with an error if a vector or array with a different number of
columns is encountered. In addition, if only vectors or arrays with the same number of columns are on the stack,
the program stops with an error after the last vector or array has been removed from the stack.
! "!Y;6E<!452!:P2<!V![[!K<2<B:!\'!<=4!1!
In the following revised version, the program simply attempts to add the level 1 object to the statistics matrix
until an error occurs. Then, it ends by displaying the message 4L=<.

Table of Contents

Other manuals for HP 48GII

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the HP 48GII and is the answer not in the manual?

HP 48GII Specifications

General IconGeneral
Battery typeCR2032
TypeScientific
Form factorPocket
Weight and Dimensions IconWeight and Dimensions
Weight220 g
Dimensions (WxDxH)184 x 87 x 23.5 mm

Related product manuals