When it has printed a screenful, it will stop, writing scroll? at the bottom of the screen. You can now inspect the first 22 numbers at your leisure. When you have finished with them, press y (for yes) and the computer will give you another screen full of numbers. Actually, any key will make the computer carry on except n (for no), SYMBOL SHIFT and A (for STOP as you can see printed on your ZX Spectrum Next's keyboard2), SPACE, BREAK (or CAPS SHIFT and SPACE) or Esc (the latter if you have a PS/2 type keyboard) . These will make the computer stop running the program with a report D BREAK - CONT repeats. On other layers, the scroll? message is replaced by a block cursor (called the scroll prompt cursor) at the lower right corner. The only keys which will stop the scrolling in layers other than 0 are the Esc key if on a PS/2 keyboard or the BREAK key (CAPS SHIFT and SPACE). Everything else will scroll the screen.
The INPUT statement can do much more than we have told you so far. You have already seen INPUT statements like:
INPUT "How old are you?", age
in which the computer prints the caption How old are you? at the bottom of the screen, and then you have to type in your age.
In fact, an INPUT statement is made up of items and separators in exactly the same way as a PRINT statement is, so How old are you? and age are both INPUT items. INPUT items are generally the same as PRINT items, but there are some very important differences:
First, an obvious extra INPUT item is the variable whose value you are to type in – age in our example above. The rule is that if an INPUT item begins with a letter, it must be a variable whose value is to be input.
Second, this would seem to mean that you can't print out the values of variables as part of a caption; however, you can get round this by putting parentheses around the variable. Any expression that starts with a letter must be enclosed in parentheses if it is to be printed as part of a caption.
Any kind of PRINT item that is not affected by these rules is also an INPUT item. Here is an example to illustrate what's going on:
myage=INT(RND(100)):INPUT("I am ";myage;
". ");"How old are you?", yourage
myage is contained in parentheses, so its value gets printed out. yourage is not contained in parentheses, so you have to type its value in.
If you are in Layer 0, everything that an INPUT statement writes goes to the bottom part of the screen, which acts somewhat independently of the top half. In particular, its rows are numbered relative to the top line of the bottom half, even if this has scrolled the actual screen up (which it does if you type lots and lots of INPUT data).
To see how AT works in INPUT statements, try running this on Layer 0:
10 INPUT "This is line
1.",a$; AT 0,0;"This is
line 0.",a$; AT 2,0;
"This is line 2.",a$; AT
1,0; "This is still line
1.",a$
2 This functionality comes from the original ZX Spectrum single key (or tokenised) entry and it's retained for compatibility reasons.
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.