Debugging Programs And Handling Errors - Texas Instruments TI-89 Manual Book

Ti ti-89: user guide
Hide thumbs Also See for TI-89:
Table of Contents

Advertisement

Debugging Programs and Handling Errors

Run-Time Errors
Debugging
Techniques
Error-Handling
Commands
310
Chapter 17: Programming
After you write a program, you can use several techniques to
find and correct errors. You can also build an error-handling
command into the program itself.
The first step in debugging your program is to run it. The
automatically checks each executed command for
TI-89 / TI-92 Plus
syntax errors. If there is an error, a message indicates the nature of
the error.
¦
To display the program in the
Program Editor, press ¸.
The cursor appears in the
approximate area of the error.
¦
To cancel program execution and return to the Home screen,
press N.
If your program allows the user to select from several options, be
sure to run the program and test each option.
Run-time error messages can locate syntax errors but not errors in
program logic. The following techniques may be useful.
¦
During testing, do not use local variables so that you can check
the variable values after the program stops. When the program is
debugged, declare the applicable variables as local.
¦
Within a program, temporarily insert
to display the values of critical variables.
and
cannot be used in a user-defined function. To
Disp
Pause
temporarily change the function into a program, change
and
to
EndFunc
Prgm
debug the program. Then remove
the program back into a function.
¦
To confirm that a loop is executed the correct number of times,
display the counter variable or the values in the conditional test.
¦
To confirm that a subroutine is executed, display messages such
as
"Entering subroutine"
end of the subroutine.
Command
Description
Defines a program block that lets the program
Try...EndTry
execute a command and, if necessary, recover from
an error generated by that command.
ClrErr
Clears the error status and sets the error number in
system variable
Passes an error to the next level of the
PassErr
block.
and
Disp
and
. Use
EndPrgm
Disp
and
Disp
and
at the beginning and
"Exiting subroutine"
Errornum
to zero.
commands
Pause
Func
and
to
Pause
and change
Pause
Try...EndTry

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ti-92 plusTi-92 plus

Table of Contents