EasyManua.ls Logo

Texas Instruments TI-99/4A - Page 126

Texas Instruments TI-99/4A
204 pages
Print Icon
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...
DEF
The
parameter
used
in
the
DEF
statement
is local to
the
DEF
statement
in which it
is
used.
This
means
that
it is riistinr.t fmm
any
variable with the
same
name
which
is
used
in
other
statements
in
the program.
Thus,
evaluating
the function does
not
affect the value
of
a variahlF. whir.h
h;l~
thp
~;lmp
n;lmp.
as
the
paramf"tf"r
A
DEF
statement
is only performed when the function it defines is
rd~r~nr.f'ri
in
'In f'xprpssion When the
computer
encounters
a
DEF
statement
while
running
a
program.
it
takes
no
action
but
proceeds
to
the
next
statement.
A
DEF
statement
may
appear
anywhere
in a
program
and
need
not
logically
precede
a
reference
to
the
function.
but the function definition
must
have a lower line
number
than
any
statement
which references the function. A
DEF
statement
can
reference
other
defined
functions
(line
170).
In a
DEF
statement,
the
function you specify may not reference
itself
either
directly (e.g.
DEF
B =B*2)
or
indirectly (e.g.
DEF
F=G;
DEF
G -
F).The
pa.ramctcrYou
specify may not
bc
uscd as
an
array.
You
can
use
an
array
element in a function definition as
long as
the
array
does
not have the
same
name
as
the parameter.
11,106
Examples:
>NEOI
>100
DEF
FUNC(A}=A*(A+B-5)
>110
A=6.9
>120 B"13
>130 PRINT
"6=
";B:"FUNCC3}"
"iFUNC(3):"A=
";A
>140
END
>RUN
6=
13
FUNC(3)= 33
A=
6.9
**
DONE
**
>NEW
>100
REM
FIND
t'
(Xl
USING
NUMERICAL
APPROXIMATION
>110
INPUT
OX;?
":X
>120 IF
ABS<X».01
THEN
150
>130
H;.oooo1
>140
GOTO
180
>150 H=.OQ1*AB$(X)
>160
DEF
F(z)=3*Z
A
3-2*Z+1
>170 DEF
DER(X)=(F(X+H)-F(X-H
})/(2*H)
>180 PRINT
"F'{"iSTR$(X);")=
"iDER(X)
>190
END
>RUN
X=?
.1
F
'
(.1}=
-1.90999997
**
DONE
**
>NEW
>100
DEF
GX(X)=GX(Z>*X
>110
PRINT
GXO)
>120
END
>RUN
W
MEMORY
FULL
iN
110
>100
DEF
GX(A)=A(3)A2
>RUN
*
NAME
CONFLICT
IN
100
User's Reference Guide

Other manuals for Texas Instruments TI-99/4A

Related product manuals