17.07.2013 Views

GWBASIC User's Manual

GWBASIC User's Manual

GWBASIC User's Manual

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.

GW-BASIC <strong>User's</strong> Guide<br />

be more than one statement on a line, and that each line is preceded by a number.<br />

For example, to create the command PRINT 2+3 as a statement, type the following:<br />

10 print 2+3<br />

When you press the RETURN key, the cursor shifts to the next line, but nothing else happens. To<br />

make the computer perform the calculation, type the following and press the RETURN key:<br />

run<br />

Your screen should look like this:<br />

Ok<br />

10 print 2+3<br />

run<br />

5<br />

Ok<br />

You have just written a program in GW-BASIC.<br />

The computer reserves its calculation until specifically commanded to continue (with the RUN<br />

command). This allows you to enter more lines of instruction. When you type the RUN command,<br />

the computer does the addition and displays the answer.<br />

The following program has two lines of instructions. Type it in:<br />

10 x=3<br />

20 print 2+x<br />

Now use the RUN command to have the computer calculate the answer.<br />

Your screen should look like this:<br />

Ok<br />

10 x=3<br />

20 print 2+x<br />

run<br />

5<br />

Ok<br />

The two features that distinguish a program from a calculation are<br />

1. The numbered lines<br />

2. The use of the run command<br />

These features let the computer know that all the statements have been typed and the computation<br />

can be carried out from beginning to end. It is the numbering of the lines that first signals the<br />

computer that this is a program, not a calculation, and that it must not do the actual computation<br />

file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/Chapter%203.html (2 of 5)28/03/2004 21.28.59

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

Saved successfully!

Ooh no, something went wrong!