Jump to content

Print debugging statement: Difference between revisions

Applesoft BASIC
No edit summary
(Applesoft BASIC)
Line 12:
<br><br>
 
=={{header|Applesoft BASIC}}==
Debugging commands TRACE and NOTRACE turn on and off showing line numbers as the program runs. The LIST command can be embedded in the program to display lines of the program. The RUN command can used to start the program at a specific line number. The STOP command stops the program and displays an error message. The CLEAR and RUN commands clear all variables.
<lang gwbasic> 0 PRINT "START"
1 IF DEBUG THEN LIST 1: PRINT "TEST"
2 IF DEBUG THEN LIST 2: TRACE
3 LIST 3: PRINT "PRODUCTION"
4 IF DEBUG THEN LIST 4, 6: PRINT "ALPHA" : RUN 4
5 NOTRACE
6 LIST 6: PRINT "END"</lang>
<lang gwbasic>RUN</lang>
{{out}}
<pre>
START
 
3 LIST 3: PRINT "PRODUCTION"
 
PRODUCTION
 
6 LIST 6: PRINT "END"
END
</pre>
<lang gwbasic>CLEAR:DEBUG=1:GOTO</lang>
{{out}}
<pre>
START
 
1 IF DEBUG THEN LIST 1: PRINT "TEST"
 
TEST
 
2 IF DEBUG THEN LIST 2: TRACE
 
#3
3 LIST 3: PRINT "PRODUCTION"
 
#3 PRODUCTION
#4
4 IF DEBUG THEN LIST 4,6: PRINT "ALPHA": RUN 4
5 NOTRACE
6 LIST 6: PRINT "END"
#4 ALPHA
#4 #4 #5
6 LIST 6: PRINT "END"
END
</pre>
=={{header|C}}==
 
413

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.