beautypg.com

Error trapping structures – HP 48g Graphing Calculator User Manual

Page 421

Attention! The text in this document has been recognized automatically. To view the original document, you can use the "Original mode".

background image

Many conditions are automatically recognized by the HP 48 as error
conditions—and they’re automatically treated as errors in programs.
A command with an improper argument or an improper number of

arguments causes an error in a program. An out-oPrange result can
cause an error. An invalid calculator condition can cause an error.

Error trapping structures allow programs to intercept (or imp) error

conditions that otherwise would cause the program to abort.

IFERR...THEN...END

Enter this structure into a program by pressing

(PRCl (NXT1 EFiFiOR

I F E R R . Its syntax is:

■ ii ... IFERR trap-clause THE'.H error-clause END ...

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.

Error Trapping Structures

IFERR...THEN...ELSE...END

29

Enter this structure into a program by pressing

(PRG] (NXT 1

(f^ I F E R R . Its syntax is:

:! R Cj F:!

IFERR

trap-clause

THEN error-clause

-SEi normal-clause Er

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, execution jumps to the normal-clause at the
completion of the trap-clause.

Programming the HP 48 29-15

This manual is related to the following products: