07.05.2015 Views

Bronze Edition Guide - True BASIC

Bronze Edition Guide - True BASIC

Bronze Edition Guide - True BASIC

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

139<br />

CHAPTER<br />

Correcting Errors and Debugging 18<br />

There are three kinds of mistakes you might make when writing a program: (1) improperly<br />

used <strong>True</strong> <strong>BASIC</strong> statements, (2) errors that occur when a program runs, and (3) “bugs” that<br />

prevent your program from working as you intended. <strong>True</strong> <strong>BASIC</strong> can help you find many<br />

of these errors, and you can learn some tricks to help you find others.<br />

Illegal Statements<br />

One of the easiest things that <strong>True</strong> <strong>BASIC</strong> can find for you is a statement or structure you<br />

have used incorrectly. When you attempt to run a program with an illegal statement, <strong>True</strong><br />

<strong>BASIC</strong> opens an error window and displays an error message that gives the line and character<br />

numbers at which the error was detected. If you double-click on one of the error messages,<br />

<strong>True</strong> <strong>BASIC</strong> will place the cursor at the offending spot in your program. You can then<br />

correct that error and run the program again. Repeat if there are more than one error in<br />

the error window.<br />

Consider the following program "WRONG":<br />

PIRNT “You are about to toss a coin”<br />

IF rnd

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!