There's a hidden cursor on the screen that points to the coordinate where the next character will be printed. Each time something is printed, a carriage return is also printed and the screen cursor is advanced to the next line (row):
PRINT "I'M ON ONE LINE" PRINT "I'M ON THE NEXT ONE"
If you don't want this to happen, you can add a semicolon (;) at the end of the
PRINT "I'M ON ONE LINE"; PRINT "... AND I'M ALSO ON THE SAME LINE" PRINT "AND I'M ON A NEW LINE"
Notice the first
NOTE: when the cursor reaches the end of the screen, it will scroll upwards all rows 1 position.
Let's prints numbers from 0 to 25 and see what happens:
CLS: REM Clears screeen and puts the cursor at the top-leftmost corner FOR i = 0 TO 25 PRINT i NEXT i
You'll see that number 0 and 1 are gone (they were shifted up and went out of the screen).
NOTE: When the screen is cleared with CLS, the cursor is set to its default position (0, 0), that is, the top-leftmost screen corner.
single element but a collection):
LET a = 5 PRINT "Variable 'a' contains the value: "; PRINT a
Indeed, if you want to chain several expressions one after another you can chain them in a single PRINT sentence using semicolons:
LET a = 5 PRINT "Variable 'a' contains the value: "; a
Changing the print position
You can change the current cursor position using the AT modifier:
PRINT AT 5, 0; "This message starts at ROW 5" PRINT AT 10, 10; "This message starts at ROW 10, COLUMN 10"
Again, you can chain all
PRINT AT 5, 0; "ROW 5"; AT 10, 10; "ROW 10, COLUMN 10"
You can temporarily override the aspect of the items printed using them inline:
CLS FOR i = 1 to 7 PRINT AT i, 0; PAPER 0; INK i; "PRINT AT ROW "; i; " WITH INK "; i NEXT i
See the related commands section for further info.
REM Prints a letter in the 10th row of the screen moving from left to right CLS FOR i = 0 TO 31 PRINT AT 10, i; "A" PAUSE 10 PRINT AT 10, i; " ": REM Erases the letter NEXT i
- This sentence is compatible with Sinclair BASIC but expands it, since it allows printing at rows 22 and 23 (all 24 rows are available to the programmer). Traditionally, Sinclair BASIC only allows to print at rows 0..21.
- You can use ITALIC and BOLD modifiers (not available in Sinclair BASIC)