(3) Debug while executing the program
Conversation type debug is performed by obtaining information from the computer
using an error message. However, when an error message is not displayed but the
calculation result is not as it should be, repeat program execution and confirm the
calculation results along the way.
There are two ways to do this: (1) the execution process is stopped using a STOP
command; (2) execution is performed in one line unit using the TR (trace) mode.
■ Debug using a STOP command
Example: Write the following program.
10 Y=0
20 INPUT N.X
3 0 F O R 1 = 1 T O N
40 Y=Y+X*X
50 NEXT 1
60 PRINT Y
70 END
In order to see the value of Y in this FOR-NEXT loop, the result of each loop is viewed
using a STOP statement.
Operation:
• The STOP statement should be placed right after the calculation formula. Therefore,
write a STOP statement between line 40 and line 50.
45 STOP 30
As a result of this, after the calculation on line 40 is completed, execution processing
will stop and a check can be made.
^(DRUNSa
8730
C u rs o r b l i n ks
STOP display
What is the value of V at this point?
7569
-42-