07.05.2015 Views

Bronze Edition Guide - True BASIC

Bronze Edition Guide - True BASIC

Bronze Edition Guide - True BASIC

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4. Writing and Running Your First Program<br />

25<br />

The result is a little more than 29 miles per gallon. (If you get different results or if the program<br />

doesn’t run, check that you entered the numbers correctly in your program and that<br />

you spelled the words miles and gallons the same way throughout. LET, PRINT, and END<br />

must also be spelled correctly.)<br />

Each line in the program is a statement in <strong>True</strong> <strong>BASIC</strong>. Like sentences in English, each<br />

statement contains an instruction that <strong>True</strong> <strong>BASIC</strong> can follow. Each statement begins with<br />

a keyword. Your program uses three types of statements: LET, PRINT, and END. You<br />

don’t have to type keywords in uppercase, but we’ve done that throughout this manual to<br />

clearly distinguish them from the rest of the information in the statement. Keywords must<br />

end with a space unless there is nothing else on the same line.<br />

The LET Statement<br />

The keyword LET tells <strong>True</strong> <strong>BASIC</strong> to assign a value to something. LET statements are<br />

sometimes called assignment statements. The first line of the program assigns the value<br />

420 to the word miles. When you again use miles in the PRINT statement, <strong>True</strong> <strong>BASIC</strong><br />

knows to use the value 420.<br />

In programs, values such as 420 are called constants, and a name such as miles, which<br />

could be assigned various values, is called a variable. You’ll learn more about constants<br />

and variables in Chapter 6.

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

Saved successfully!

Ooh no, something went wrong!