Download Print this page

Radio Shack TRS-80 model III Owner's Manual page 107

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

Advertisement

TRS-80
MODEL
III
DISK
SYSTEM
Turns dual
video/printer output
off.
DEFFN
Define
Function
formula
function
does.
formula
is
an
expression
usually involving the
argument(s)
|
the
teM^
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
def fn
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
(9(3)
+
9
defines a
function
to
return
a
random
value
between
10
and
99.
106

Advertisement

loading