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 #351 background imageLoading...
Page #351 background image
FOR SERVICE MANUALS
CONTACT:
MAURITRON
TECHNICAL
SERVICES
www.mauritron,co.uk
TEL: 01844 - 351694
FAX: 01844 - 352554
Pro<Jrarnmirg
proc
change
rem
*****
alter
record
*****
let
n$
="
X
"
c Ls
whi
le
n$ <>'"'
getrec
if
ok$
="
y
"
alter
cLs
endif
endwhi
Ie
endproc
PARAMETERS
We
shall now take a short break from the development of the program
to
describe the
use of
parameters with procedures.
You
can use a parameter
to
pass a value
to
a
procedure, rather than using the value of a variable.
We
shall
show
you
a
few
examples
of how they can be used.
You
do
not need
to
save these procedures
in
"maillist" and
you may delete them before moving
on
to
the section of the program which deals with
labels.
Try
the following simple example. Using the line
editor,
you
add the parameter
to
the
line containing the procedure name.
proc
test;
a
pri
nt
5*a
endproc
This defines a procedure called test which requires one parameter,
'f!':
Notice that the
parameter
is
separated from the name of the procedure
by
a semicolon. Whenever
you
use the procedure
you
must always supply a value
for
the parameter For example,
you
could type:
test;
3
which
will
print the value
15
- the number
(3)
has been passed
to
the procedure as
the value of the variable
a.
You
may specify any number of parameters for a procedure, provided
you
separate
them by commas.
For
example:
proc
trial;
a,b,c
print
a * b * c
endproc
which
you
can call
by:
trial;
3,4,5
The values you supply
do
not have
to
be literal values, but could be variables,
as
shown
below:
Let
x = 2
Let
y 5
Let
z = 7
trial;
x,y,z
Note that the names of the variables
do
not have
to
be the same as the names used
within the procedure.
We
can distinguish between the tormal parameters
(e.g.
a,b,c)
in
the definition of the procedure, and the actual parameters which are the actual values
that are passed
to
the procedure.
You
can also pass the results of expressions:
trial;
x*2,z/y,
(z-y)*x
You
are not restricted
to
uSing
numeric variables but can also pass strings (or string
expressions) as parameters, provided you specify string variables
in
the definition of the
procedure. For example:
l
24
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