Example
DEF
FNA
CX)
=2)K
X i
2+3*
X
+1
·
··
···Defines 2X
2
+
3X
+ 1
as
FNA
(X).
DE
F F
NE
CV)
=1
1
2*
M*
Vi
2 ········
········Defines
l/2MV
2
as
FNE (V).
10
DEF
FNB
CX)
=TAN
CX
-
PA
I ( 1 ) / 6 )
2 0
DEF
FND
CX)
=FNB
C
X)/
C+
X··Defines function FNB using the
function defined
on
line 1
0.
(Incorrect definitions)
1 0
DEF
FNK
CX)
=SIN
CX/
3+PAI
C
1)
/4),
FNL
CX)
=E
XP C- X
i2
/K)
. .
..
Only one user function c
i:
m be defined by a single
DEF
FN
statement.
Find
the
kinetic energy
of
a mass
of
5.5 when
it
is imparted with initial accelerations
of
3.5, 3.5 x 2, and 3.5 x 3.
10
DEF
FNE
CV)
=1
/
2*M*Vi2
2 0
M=5.
5 :
V=3.
5
3 0
PRINT
FNE
CV
) ,
FNE
C
V*2
) .
FNE
C
V*3
)
4 0
END
Note All user function definitions are cleared when the CLR statement and the NEW
statement
is executed.
2. 3. 7. 3
DEF
KEY
I Format I DEF
KEY
(k) = S$
Function
k
..
.
...
Definable function key
number
(1
to
10)
S$
..
.
..
Character string (up
to
15
characters).
Character strings can be assigned
to
any
of
the ten function keys
to
allow strings
to
be entered
at
any time
just
by
pressing a single key. This statement
is
used
to
define such strings and assign them
to
the definable function keys.
Function
key
numbers 1
to
5 are entered
just
by
pressing the corresponding key at the
top
left
corner
of
the keyboard; keys 6
to
10 are entered
by
pressing the I SHIFT I key
together with the corresponding key. The function key
number
(1
to 10)
is
specified
in k, and the string
or
command which
is
to
be assigned
to
the key
is
specified
exactly
as
it
is
to
be entered in
S$
. Execution
of
the
DEF
KEY statement cancels
the previous definition
of
the definable function key.
No
other
statement
can be specified after a
DEF
KEY statement on the same line.
(Example:)
1 0
DEF
2 0
DEF
K E Y C 1 ) =
11
I N
PUT
11
• • • • • • • •
··
·····Defines key
[fl]
as
INPUT
KEY
C2 ) =
11
RUN
11
+CH
R$
(
13
)··· Defines I
F21
as
RUN J
Note: CHR$ (13) indicates the ASCII code fori
CRI,
and specifying it together with the string assigned
to
a definable function key has the same effect
as
pressing the I
CRI
key. (See the description
of
the
CHR$ function
on
page 78 and the ASCII code table on page 154.)
------
--
------
--
------------------------------------------
----
--
----
- 57