EasyManua.ls Logo

Commodore VIC-20 - Page 134

Commodore VIC-20
404 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...
120
The
VIC
20
User
Guide
When numeric variables are assigned to numeric strings using the
STR$ function, the sign value preceding the number (blank
if
positive,-if
negative)
is
transferred along with the number. This
is
shown in the follow-
ing short program:
",1'£1
,AB-t2343
.
20
PI-
-1*3.14159265
3£1
n-STR$(AB)
4£1
,
N.t~:r~'(PIL,
;~ePR;l~!,"AB~!~l!JB
/'60
PRf~i,iT,-'1
fT
•.
78
PRINT
"NI-";N$
RUN
+ Space left for sign value
AB....
12343
T$...
12343
N:$=-3.1415:5'26!5
However, if a number
is
entered enclosed in quotation marks,
or
if the
number
is
entered as a string with
an
INPUT
or
READ
statement, then the
numeric string is treated like any other alphabetic
or
graphic string. No
blank for a positive sign value
is
inserted before the number. This
is
demon-
strated in the following program:
Ie
AB"12345
28
Tf-"12345"
38
READ
R$
4£1
DATA
12345
5£1
PRINT
"AB=";AB
68
PRINT"Tf=";Tf
78
PRINT
"R$="jR$
RUN
AB-
12345
~.----
Space inserted
T$-12345
No space inserted
R$-12345
No space inserted
Concatenate the two numeric strings T$ and Q$
to
make a new numeric
string
W$
so
that
the string
W$
contains the ten digits 1,2,3,4,5,6,7,8,9,0.
Here
is
one possibility:
18
r-12345.
20
1iI=67890
30
l~'i5§'TRS(
n

Other manuals for Commodore VIC-20

Related product manuals