EasyManua.ls Logo

Sinclair QL

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
Loading...
Programming
30
proc
getnum;
m$,min,max
rem
*****
get
number
in
range
*****
local
wrong
let
_rong=1
whi
le
wrong
print
m$;
"?
II;
error
readnum
let
wrong=errnumO
if
not
wrong
if
num<min
or
num>max
let
wrong=1
print
"Allowed
range
;s
";min;"
to
";max
endif
endif
if
wrong
print
"Try
again"
end
if
endwhi
le
endproc
Since error must be followed
by
the name
of
a procedure.
we
define readnum
to
input
a value
for
the vanable num.
proc
readnum
input
num
endprac
Suppose
you
want a procedure thaf checks that a number
is
within the range 1
to
10
You
can do
this
uSing
getnum
in
the following
way:
prac
check
getnum;
"Numeric
value?",1,10
endproc
12/S-l

Other manuals for Sinclair QL

Related product manuals