Download Print this page

Radio Shack TRS-80 Owner's Manual page 124

Mini-disk operation disk operating system disk basic programming language
Hide thumbs Also See for TRS-80:

Advertisement

1
TRS-80
MODEL
ill
DISK
SYSTEM
,t^-
I
IMIM
CMD"Z"
,
"OFF"
Turns dual
video/printer output
off.
DEFFN
Define
Function
owm
function
name
{argmneri!--;
;
-.
;rrr-:uis
function
na-rig
s
«py
xdMC
ism?':. -?
-•
argumeni-1
anri
si&ssciie»iv
s!
,
g!,
:
rr.
<<.;>!?
•?:>
^-&r:
•"
'^
:
-
:
*
v
v H
^-
-
:
'
fiincfiosi
das?.
formula
is
an
sxprsssic-s
f.s^s=f«
"iv
!i
r*p
"'*
-.
:^k?' v?
;
;^a^
^r.
the
left
side
of
the
equals
sign.
The def
fn
statement
lets
you
create
your
own
function.
That
is,
you
only
have
to call
the
new
function
by name, and
the
associated operations
will
automatically
be performed.
Once
a function
has
been
defined with
the
deffn
statement,
you
can
call
it
simply by
inserting
fn
in front
of function
name.
You
can use
it
exactly as
you
might
use
one
of
the
built-in
functions,
like sin,
abs,
and
strings.
The
type of
variable
used
for
function
name
determines
the
type of value
the
function
will return.
For example,
if
function
name
is
single precision,
then
that
function
will
return
a single-precision value, regardless of
the precision
of
the
arguments.
The
particular variables
you
use
as
arguments
in
the
def fn
statement
(argument-1,
.
.
.)
are not
assigned
to
the function.
When
you
call
the
function
later,
any
variable
name
of
the
same
type
can be
used.
Furthermore, using
a variable as
an
argument
in
a
def
fn
statement has
no
effect
on
the
value of
that variable.
So you
can
use
that
particular variable
in
another
part
of your
program
without worrying about
interference
from def
fn.
The
function
can be
defined with
no
arguments
at
all, if
none
are required.
For example:
DEF FNR
=
RND
(90)
+
9
defines a function to return a
random
value
between
10
and
99.
108

Advertisement

loading

This manual is also suitable for:

Model iii