-
Notifications
You must be signed in to change notification settings - Fork 8
BASIC PRINT Statements
TYPE: BASIC I/O Statement
FORMAT: PRINT [variable][,/; variable]...
Action:
The PRINT statement is used to write data items to the screen. The variable(s) in the output-list are expressions of any type. If no output-list is present, a blank line is printed. The position of each printed item is determined by the punctuation used to separate items in the output-list.
The punctuation characters that you can use are blanks, commas, or semicolons. The 40-character screen line is divided into 2 print zones, the first at column 0 and the second at column 14. In the list of expressions, a comma causes the next value to be printed at the beginning of the next zone. A semicolon causes the next value to be printed immediately following the previous value. However, there are two exceptions to this rule:
- Numeric items are followed by an added space.
- Positive numbers have a space preceding them.
When you use blanks or no punctuation between string constants or variable names it has the same effect as a semicolon. However, blanks between a string and a numeric item or between two numeric items will stop output without printing the second item.
If a comma or a semicolon is at the end of the output-list, the next PRINT statement begins printing on the same line, and spaced accordingly. If no punctuation finishes the list, a carriage-return and a linefeed are printed at the end of the data. The next PRINT statement will begin on the next line. If your output is directed to the screen and the data printed is longer than 40 columns, the output is continued on the next screen line.
There is no statement in BASIC with more variety than the PRINT statement. There are so many symbols, functions, and parameters associated with this statement that it might almost be considered as a language of its own within BASIC; a language specially designed for writing on the screen.
Control characters can be printed to perform specific actions. These include:
- CHR$(7) "BEL" Make a beep sound.
- CHR$(8) "BS" Move cursor left and clear new cursor location.
- CHR$(10) "LF" Move the cursor to the same column on the next line.
- CHR$(11) "FF" Clear the screen.
- CHR$(13) "CR" Move the cursor to the beginning of the next line.
EXAMPLES of PRINT Statement:
5 X = 5
10 PRINT -5*X,X-5,X+5,X^5
-25 0
10 3125
5 X=9
10 PRINT X;"SQUARED IS";X*X;"AND";
20 PRINT X "CUBED IS" X^3
9 SQUARED IS 81 AND 9 CUBED IS 729
90 AA$="ALPHA":BB$="BAKER":CC$="CHARLIE":DD$="DOG":EE$="ECHO"
100 PRINT AA$BB$,CC$ DD$;EE$
ALPHABAKER CHARLIEDOGECHO
TYPE: BASIC I/O Statement
FORMAT: LPRINT [variable][,/; variable]...
Action:
The LPRINT statement is used to write data items to an attached serial printer. It works like the PRINT statement with thr following exceptions.
-
The comma separator uses 9 prinr zones, each 14 characters wide.
-
A 132 character logical print line is used. When column 132 is reached, a CR and LF are sent to the printer.
-
An LPRINT that does not end with a comma or semicolon sends a CHR$(13) [CR] and CHR$(10) [LF] to the printer when finished.
The only control character ecognized by LPRINT is CHR$(9) "TAB" Move the cursor to the next tab stop: 0, 8, 16, etc.
All other characters are passed directly through to the printer.
EXAMPLES of LPRINT Statement:
To Search for pages in the wiki, press Pages above and type a search term in the "Find a page..." box. Results will update beneath automatically.
- Aquarius+ User Guide
- Quick Start
- Hardware
- Software
-
Other Development Resources