Look at the PRINT statement on line 50. The punctuation or print modifier in this – the comma ( , ) is very important, and you should remember that it follows much more definite rules than the punctuation in English. PRINT accepts 3 print modifiers: Commas ( , ), Semicolons ( ; ) and Apostrophes ( ' ).

Commas are used to make the printing start either at the left hand margin, or in the middle of the screen, depending on which comes next. Thus in line 50, the comma causes the Celsius temperature to be printed in the middle of the line. With a semicolon ( ; ) on the other hand, the next number or string is printed immediately after the preceding one. You can see this in line 50, if the comma is replaced by a semicolon. Note here that this is the exact reason why we need to enter a colon before the semicolon if we need to use it as a REMark as discussed in the previous section!

Another punctuation mark you can use like this in PRINT commands is the apostrophe ( ' ). This makes whatever is printed next appear at the beginning of the next line on the screen but this happens anyway at the end of each PRINT command, so you will not need the apostrophe very much. This is why the PRINT command in line 50 always starts its printing on a new line, and it is also why the PRINT command in line 30 produces a blank line.

If you want to inhibit this, so that after one PRINT command the next one carries on on the same line, you can put a comma or semicolon at the end of the first. To see how this works, replace line 50 in turn by each of:

50 PRINT F,
50 PRINT F;

and:

50 PRINT F

and run each version – for good measure you could also try:

50 PRINT F'

The one with the comma spreads everything out in two columns, that with the semicolon crams everything together, that without either allows a line for each number and so does that with the apostrophe – the apostrophe gives a new line of its own, but inhibits the automatic one.

Remember the difference between commas and semicolons in PRINT commands; also, do not confuse them with the colons (:) that are used to separate commands in a single line. Now type in these extra lines:

100 REM this polite program
    remembers your name
110 INPUT n$
120 PRINT "Hello ";n$;"!"
130 GO TO 110

This is a separate program from the last one, but you can keep them both in the computer at the same time. To run the new one, type:

RUN 100

Because this program inputs a string instead of a number, it prints out two string quotes – this is a reminder to you, and it usually saves you some typing as well. Try it once with any alias you care to make up for yourself.

Next time round, you will get two string quotes again, but you don't have to use them if you don't want to. Try this, for example. Rub them out (with ⇨ and DELETE twice), and type:

n$

ZX Spectrum Next User Manual, 3rd Edition (ISBN 978-1-5272-5496-1), written and illustrated by Phoebus R. Dokos. Copyright © 2020-2024 Phoebus Dokos / SpecNext Ltd. Licensed under CC BY-NC-SA 4.0. This is a transcription and can contain errors; check any doubt against the printed page.