Application Guide

Try
Catalog >
Try
block1
Else
block2
EndTry
Executes block1 unless an error occurs.
Program execution transfers to block2 if an
error occurs in block1. System variable
errCode contains the error code to allow
the program to perform error recovery. For
a list of error codes, see Error codes and
messages,” page 251.
block1 and block2 can be either a single
statement or a series of statements
separated with the “:” character.
Note for entering the example: For
instructions on entering multi-line program
and function definitions, refer to the
Calculator section of your product
guidebook.
To see the commands Try, ClrErr, and
PassErr in operation, enter the eigenvals()
program shown at the right. Run the
program by executing each of the following
expressions.
Note: See also ClrErr, page 25, and PassErr,
page 132.
Define eigenvals(a,b)=Prgm
© Program eigenvals(A,B) displays
eigenvalues of AB
Try
Disp"A= ",a
Disp"B= ",b
Disp" "
Disp"Eigenvalues of AB are:",eigVl(a*b)
Else
If errCode=230 Then
Disp "Error: Product of AB must be a
square matrix"
ClrErr
Else
PassErr
EndIf
EndTry
EndPrgm
Alphabetical Listing 191