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 />

together in a logical manner to create programs. The GW-BASIC <strong>User's</strong> Reference describes all of<br />

the statements available for use in GW-BASIC.<br />

In a GW-BASIC program, lines have the following format:<br />

nnnnn statement[statements]<br />

nnnnn is a line number<br />

statement is a GW-BASIC statement.<br />

A GW-BASIC program line always begins with a line number and must contain at least one<br />

character, but no more than 255 characters. Line numbers indicate the order in which the program<br />

lines are stored in memory, and are also used as references when branching and editing. The<br />

program line ends when you press the RETURN key.<br />

Depending on the logic of your program, there may be more than one statement on a line. If so,<br />

each must be separated by a colon (:). Each of the lines in a program should be preceded by a<br />

line number. This number may be any whole integer from 0 to 65529. It is customary to use line<br />

numbers such as 10, 20, 30, and 40, in order to leave room for any additional lines that you may<br />

wish to include later. Since the computer will run the statements in numerical order, additional<br />

lines needn't appear in consecutive order on the screen: for example, if you entered line 35 after<br />

line 60, the computer would still run line 35 after line 30 and before line 40. This technique may<br />

save your reentering an entire program in order to include one line that you have forgotten.<br />

The width of your screen is 80 characters. If your statement exceeds this width, the cursor will<br />

wrap to the next screen line automatically. Only when you press the RETURN key will the<br />

computer acknowledge the end of the line. Resist the temptation to press RETURN as you approach<br />

the edge of the screen (or beyond). The computer will automatically wrap the line for you. You<br />

can also press CTRL-RETURN, which causes the cursor to move to the beginning of the next screen<br />

line without actually entering the line. When you press RETURN, the entire logical line is passed to<br />

GW-BASIC for storage in the program.<br />

In GW-BASIC, any line of text that begins with a numeric character is considered a program line<br />

and is processed in one of three ways after the RETURN key is pressed:<br />

● A new line is added to the program. This occurs if the line number is legal (within the<br />

range of 0 through 65529), and if at least one alpha or special character follows the line<br />

number in the line.<br />

● An existing line is modified. This occurs if the line number matches the line number of an<br />

existing line in the program. The existing line is replaced with the text of the newlyentered<br />

line. This process is called editing.<br />

file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/Chapter%202.html (7 of 8)28/03/2004 21.28.57

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

Saved successfully!

Ooh no, something went wrong!