Computers have three basic abilities: they can calculate, make decision, and communicate. Calculation is probably the easiest to program. Most of the rules of mathematics are familiar for us. Decision making is not too difficult, since the rules of logic are relatively few, even if you don't know them too well yet.
Communication is the most complex, because it involves the least exacting set of rules. This is not an oversight in the design of computers.
The simples form of output in BASIC is the PRINT
statement.
PRINT
uses the TV screen as the output device, and your
eyes are the input device because they use the information on the
screen.
When PRINT
ing on the screen, your main objective is to
format information on the screen so it's easy to read. You should try to
think like a graphic artist, using colors, placement of letters, capital
and lower case letters, as well as graphics to best communicate the
information. Remember, no matter how smart your program, you want to be
able to undestand what the results mean to you.
The PRINT
statement uses certain character codes as
"commands" to the cursor. The CRSR key doesn't actually
display anything, it just makes the cursor change position. Other
commands change colors, clear the screen, and insert or delete spaces.
The RETURN key has a character code number
(CHR$
) of 13. A complete table of these codes is contained
in Appendix C.
There are two functions in the BASIC language that work with the
PRINT
statement. TAB
positions the cursor on
the given position from the left edge of the screen, SPC
moves the cursor right a given number of spaces from the current
position.
Punctuation marks in the PRINT
statement serve to separate
and format information. The semicolon (;
) separates two
items without any spaces in between. If it is the last thing on a line,
the cursor remains after the last thing PRINT
ed instead of
going down to the next line. It suppresses
This page has been created by Sami Rautiainen. | |
Read the small print. | Last updated May 20, 1998. |