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 #64 background imageLoading...
Page #64 background image
CHAPTER
9
DATA
TYPES
VARIABLES
AND
IDENTIFIERS
You
will
have
noticed that a program
(a
sequence
of
statements) usually gets some data
to
work
on
(input) and produces some kind
of
results
(output).
You
will
also have
understood that there
are
Internal arrangements
for
storing this
data.
In
order
to
avoid
unnecessary technical explanations
we
have suggested that
you
imagine pigeon holes
and
that
you
choose meaningful names for the pigeon
holes.
For
example,
if it
is
necessary
to
store
a number which represents the score
from
simulated dice-throws
you
imagine a pigeon hole named score which might contain a number such
as
8.
Internally the pigeon holes
are
numbered and the
system
maintains a dictionary which
connects particular names
with
particular numbered pigeon
holes.
We
say
that the
name,
score,
points
to
its
particular pigeon-hole (by means
of
fhe
Internal dictionary).
score~"
~J
The
whole arrangement
is
called a variabfe.
What you
see
is
the word
score.
We
say that this word,
score
IS
an
identifier.
It
is
what
we
see
and
It
identifies the concept
we
need,
In
this
case the
result,
8,
of
throwing a
pair
of
dice.
Because the identifier
IS
what
we
see
it
becomes the thing
we
talk or write
or think about.
We
write about score and
its
value
at
any
particular moment.
There
are
four
simple data types called floating point, integer string and logical and
these
are
explained
below.
We
talk about data types rather than variable types because
data can occur
on
its
own,
for
example
3.4
or 'Blue hat'
as
the value
of
a variable. But
if
you understand the different types
of
variables, you must also understand the different
types
of
data.
A SuperBASfC identifier must begin with a letter and
is
a sequence
of:
upper or lower case letters
digits or underscore
2.
An Identifier may be up
to
255 characters
in
length so there
is
no effective limit
in
practice.
IDENTIFIERS
AND
1.
VARIABLES
3.
An
identifier cannot be the same
as
a keyword
of
SuperBASIC
4. An integer variable name
is
an
identifier
with
%
on
the end.
5.
A string variable name
is
an
identifier with $
on
the end.
6.
No other identifiers must use the symbols % and
$.
7.
An
identifier should usually
be
chosen so that
it
means something
to
a human
reader but for SuperBASIC
it
does not have any particular meaning other than
that
It
Identifies certain things.
FLOATING
POINT
VARIABLES
Examples
of
the use
of
floating point variables
are:
100
LET
days
= 24
110
LET
sales
=
3649.84
120
LET
sales
per
day
=
saLes/days
130
PRINT
sa
Les_per_day
48
12/84

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