The largest integer (whole number) that can be held completely accurately is 1 less than 32 2s multiplied together (or 4,294,967,295) – in other words: 2³²-1

The string "" with no characters at all is called the empty or null string. Remember that spaces are significant and an empty string is not the same as one containing nothing but spaces. Try:

PRINT "Have you finished "Finne
gans Wake" yet?"

When you press ENTER, you will get the flashing red cursor mark that shows there is a mistake somewhere in the line. When the computer finds the double quotes at the beginning of "Finnegans Wake", it imagines that these mark the end of the string "Have you finished ", and it then can't work out what Finnegans Wake means.

There is a special device to get over this; whenever you want to write a string quote symbol in the middle of a string, you must write it twice, like this:

PRINT "Have you finished ""Finn
egans Wake"" yet?"

As you can see from what is printed on the screen, each double quote is only really there once; you just have to type it twice to get it recognised.

Decimal, Binary and Hexadecimal numbers

Number literals in NextBASIC can be expressed in Decimal (default), Binary (preceded by @) and Hexadecimal (preceded by $). In the case of integer only literals, the same rule as any with other integer expression applies to binary and hexadecimal literals; they need to be preceded by %, once per expression. Consider these examples:

PRINT %$E3, @11100011

PRINT $E3, %@11100011

PRINT %$E3+@11100011

PRINT $E3+%@11100011

The first example prints an integer and then a floating point number autoconverted from hexadecimal and binary respectively. The same thing happens in the second case but with the first value being a floating point one and the second an integer as again there are two separate expressions following the PRINT keyword. The third example is also valid as it contains a properly marked (preceded by %) integer expression. The addition of the hexadecimal and binary numbers is a single integer expression as the % preceding the addition marked both numbers as integer (and therefore it doesn't need a second %). The fourth example however is NOT valid as it's trying to add a floating point number with an integer number and this expression will fail.

In the case of floating point literals, both hexadecimal and binary numbers can have fractional parts. For example:

BIN 1.1is the same as 1.5 (decimal)
@10.01is the same as 2.25 (decimal)
$64.cis the same as 100.75 (decimal)

More about Integer Expressions and Variables

As previously mentioned, the main two reasons for the use of Integer Variables, Arrays and Expressions, is memory efficiency and speed of execution.


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.