Radio Shack TRS-80 Trsdos & Disk Basic Reference Manual page 98

Micro computer system
Hide thumbs Also See for TRS-80:
Table of Contents

Advertisement

DISK BASIC
Examples:
19 DEFFNMLKfi,
B)=fi*B
2@ INPUT "ENTER ARGUMENTS";
X,
36 PRINT "PRODUCT
IS";
FNMLT<X,Y>
Notice
that
FNMLT
is
defined
with arguments A,B, but
that
when
the function
is
called in line
30, variables
X
and
Y
are used.
Any
two
valid
variable
names
can be used
to pass values to
the function.
DEF FNRR<A, B>=fi+INT<B*RND03>}
DEF
FNLS*
< fi* )
=LEFT*
(
H$,
8
DEF FNX#
<
A#,
B#
)
=
(
m-B%
)
*
<
R#-B#
>
Returns
a
random
number
between
A
and
B.
Returns
first
8
characters
of
string
argument
Returns double-
precision value of
"the
square of the
difference"
100
"'
PROGRAM: STRING
110
'
EXAMPLE
OF
fi
STRING DEFFN FUNCTION
120
'
13:0
'
******* FUNCTION TO CONCATENATE STRINGS *******
135
"'
140 DEF FNADD*
<A$,
B$)
=
fit-
+
"
"
+
Bf-
150
CLS:
PRINT TAB
<
15);
"STRING DEFFN EXAMPLE"
160 PRINT: F*=
nii
:
INPUT "ENTER FIRST NAME"; F$
165
IF
F*="" THEN END
170 INPUT "ENTER LAST
NAME";
LI-
180
-'
•130
-
******* RDD
FI-
TO L$ WITH
1
BLANK
IN
BETWEEN *******
200
-'
210
Z$
=
FNADD$
<F$,
L$>
220 PRINT
TAB<6);
"FULL NAME:
";
2$
230 GOTO 160
RUN
[121051
STRING DEFFN EXAMPLE
ENTER FIRST NAME? JOH
N
UMM
ENTER LAST
NAME?
DOEH2H13
FULL
NAME:
JOHN DOE
7-12

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents