EasyManuals Logo

Sinclair QL User Manual

Sinclair QL
422 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 #93 background imageLoading...
Page #93 background image
•
•
•
200
FOR
num
= 0
TO
9
210
PRINT
'FLat'
I
num
I
fLat$(floor,num)
220
END
FOR
num
230
END
FOR
fLoor
240
DATA
"AII,"B","C",IID","E",IIF","G","H","I","JII
250
DATA
"K","L","M","N","O","P","QII,"R","S",IlTII
260
DATA
"U",
"V",
"W",
"X'I,
"yII,
liZ",
II@","£","$",'I%"
The output starts:
FLoor
number
0
FLat
0 A
FLat
1 B
FLat
2 C
and continues giving the thirty occupants.
You
may find this section hard
to
read though
It
IS
essentially the same concept
as
strlng-
slicing.
You
will probably need string-slicing
if
you get beyond the learning stage of
programming. The need for array-slicing
is
much rarer and
you
may wish
to
omit this
section particularly
on
a
first
reading.
We
now use the golfers'
flats
to
illustrate the concept of array
sliCing.
The
flats
will
be
numbered
0
to
9
to
keep
to
single digits and names
will
be single characters
for
space
reasons.
2,0
2,1
2,2
2,2
3,4 2,5 2,6
2,7
2,8 2,9
flat$0~G0[2]0[!]00~
1,0
1,1
1,2
1,3
1,4
1,5
1,6 1,7 1,8 1,9
flat$0~00G0000[2]
Given the above values the
follOWing
are array slices:
fLat$(1,3)
Means a single array element with value N
f
Lat$
(1,1
TO
6)
Means six elements with values L M N 0 P Q
Array Element Value
fLat$(1,1J
L
fLat$(1,2)
M
fLat$(1,3)
N
flat$(1,4)
0
flat$(1,5)
P
flat$(1,6)
Q
ARRAY
SLICING
,
Arrays
flat$(1J
Means flat$
(1,0
TO
9)
ten elements with values K L M N 0 P Q R S T
In
these examples a range
of
values of a SUbscript can be given instead of a single
value.
If
a subscript
is
missing completely the complete range
is
assumed.
In
the third
example the second subscript
is
missing and
it
is
assumed
by
the
system
to
be a
TO
9.
The techniques of array
sliCing
and string
sliCing
are similar though
the
latter
is
more
widely applicable.
1?l84
77

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