EasyManuals Logo

Tandy 1000 Basic Reference Manual

Default Icon
411 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 #139 background imageLoading...
Page #139 background image
Chawter
10
I
BASIC
Kevwords
DEF
FN
Statement
DEF FNname [(argument
list)]
=expression
Defines
mme
as
a
function according to the
expression.
Name
must be a valid variable name. The type of variable you
use determines the type of value the function returns. For exam-
ple, if you use a single precision variable, the function returns
single precision values. This name, preceded by FN, is the name
of the function when you call it.
Argument list
is
a
list of dummy variables used in
expression.
They are replaced on a one-to-one basis with the variables or
values given when the function is called. If you enter several
variables, separate them with commas. These variables do not
affect variables in your program with the same name.
Expression
defines the operation to be performed.
A
variable
used in
a
function definition may or may not appear in
argument
list.
If it does,
BASIC
uses the value given when the function is
called to perform the function. Otherwise, it uses the current
value of the variable.
Once you define and name a function (by using this statement),
you can use it as you would any
BASIC
function.
Examples
DEF FNR
=
RND (1)*89+10
defines a function FNR to return a random value between 10
and
99.
Notice that the function can be defined with no
arguments.
210 DEF FNW#
<A#,B#)=(A#-B#)*<A#-B#)
220
I#
=
345.998
230
J#
=
150.667
240 T
=
FNW#(I#,J#)
250 PRINT T
defines function FNW# in Line 210 using dummy variables
A#
and
B#.
Line 240 calls the function and replaces variables
A#
and
B#
with variables
I#
and
J#
which are used in the
program.
137

Table of Contents

Other manuals for Tandy 1000

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Tandy 1000 and is the answer not in the manual?

Tandy 1000 Specifications

General IconGeneral
ProcessorIntel 8088
Processor Speed4.77 MHz
RAM128 KB (expandable to 640 KB)
Operating SystemMS-DOS 2.11
ManufacturerTandy Corporation
Release Year1984
StorageSingle or double 5.25" floppy disk drive (360 KB), optional hard drive
SoundTandy 3-voice sound
PortsParallel, Serial
GraphicsCGA (Color Graphics Adapter)
Graphics Modes320x200, 640x200

Related product manuals