EasyManua.ls Logo

Radio Shack TRS-80 Model 4 - Page 299

Radio Shack TRS-80 Model 4
418 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
Loading...
VAL
I VAL(sl,ing)
Function I
Calculates the numerical value of string.
VAL
is
the inverse of the STR$ function; it returns the number
represented by the characters
in
a string argument. This number may
be
integer, single precision, or double precision, depending
on
the
range of values and the rules used for typing
all
constants.
For example, if
A$
=
"12"
and
8$
=
"34"
then VAL(A$ +
"."
+ 8$)
returns the value
12.34 and VAL(A$ +
"E"
+ 8$) returns the value
12E34, that
is,
12
*
10"
34.
VAL terminates its evaluation
on
the first character which has no
meaning
in
a numeric value.
If
the string
is
non-numeric or null, VAL returns a zero.
Examples
PR
I NT
I.JAL
( "
100
DOLLARS")
prints 100.
PR
I NT
I.JAL
( "
123L1E5"
)
prints 1.234E +08.
B =
I.JAL
(
"3"
+
"*"
+
"2")
assigns the value 3 to 8 (the asterisk has no meaning
in
a numeric
term).
Sample Program
10
READ
NAMES$,
CITY$,
STATE$,
ZIP$
20
IF
VAL(ZIP$)
<
90000
OR
VAL(ZIP$)
>
96699
THEN
PRINT
NAME$
TAB(25)
"OUT
OF
STATE"
30
IF
I.JAU
Z I
P$)
>
90801
AND
I.JAU
Z I
P$)
<=
90815
THEN
PR
I NT NAME$ TAB
(25)
"LONG
BEACH"
2-173

Other manuals for Radio Shack TRS-80 Model 4

Related product manuals