EasyManuals Logo

Sinclair QL Beginner's Guide

Sinclair QL
135 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #26 background imageLoading...
Page #26 background image
Word$
OF
Month
FEBRUARY
Phrase$
FIRSTOFFEBRUARY
There is one more reasonable simplification which is to use READ and DATA instead of the first three
LET statements. Type:
NEW
10 READ weekday$, word$, month$
20 LET phrase$ = weekday$ & word$ & month$
30 LET length = LEN(phrase$)
40 PRINT length/3
50 DATA "FIRST","OF","FEBRUARY"
RUN
The internal effects of this version are exactly the same as those of the previous one. READ causes
the setting up of internal pigeon holes with values in them in a similar way to LET.
IDENTIFIERS AND STRING VARIABLES
Names of pigeon holes, such as:
weekday$
word$
month$
phrase$
are called string identifiers. The dollar signs imply that the pigeon holes are for character strings.
The dollar must always be at the end.
Pigeon holes of this kind are called string variables because they contain only character strings
which may vary as a program runs.
The contents of such pigeon holes are called values. Thus words like 'FIRST' and 'OF' may be values
of string variables named weekday$ and +word$
RANDOM CHARACTERS
You can use character codes (see Concept Reference Guide) to generate random letters. The upper
case letters A to Z have the codes 65 to 90. The function CHR$ converts these codes into letters. The
following program will print a letter B.
NEW
10 LET lettercode = 66
20 PRINT CHR$ (lettercode)
RUN
The following program will generate trios of letters A, B, or C until the word CAB is spelled
accidentally.
NEW
10 REPeat taxi
20 LET first$ = CHR$(RND(65 TO 67))
30 LET second$ = CHR$(RND(65 TO 67))

Other manuals for Sinclair QL

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Sinclair QL and is the answer not in the manual?

Sinclair QL Specifications

General IconGeneral
ProcessorMotorola 68008
Clock Speed7.5 MHz
RAM128 KB (expandable to 640 KB)
ROM48 KB
Operating SystemSinclair QDOS
Release Year1984
StorageMicrodrive tape loop
Graphics256x256 pixels, 8 colors
PortsRS-232, ROM cartridge
SoundBeeper (internal speaker)

Related product manuals