Radio Shack CTR-118 User Manual Page 68

  • Download
  • Add to my manuals
  • Print
  • Page
    / 196
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 67
5-2
String Input/Output
String constants -sequences of alphanumeric characters - may be input to a
program just as numeric constants are input, using INPUT, READ/DATA,
and INPUT # (input from cassette). They may generally be input without
quotes:
10 INPUT "YES OR NO";R$
20 IF R$="YES"PRINT"THAT'S BEING POSITIVE!": END
30 PRINT "WHY NOT?"
RUN
YES OR NO?_
[you type]
YES
[ENTER]
THAT'S BEING POSITIVE!
READY
>_
However, to input a string constant, which contains commas, colons,
or leading blanks, the string must be enclosed in quotes.
10 INPUT "LAST NAME, FIRST NAME";N$
20 PRINT N$
RUN
LAST NAME, FIRST NAME?_
[you type:]
"SMITH,JOHN"
[ENTER]
SMITH,JOHN
READY
>_
The same rule regarding commas, colons and leading blanks applies to values
input via DATA statements and INPUT # statements.
10 READ T$,N$,D$
20 PRINT T$;N$;D$
30 DATA "TOTAL IS: ","ONE THOUSAND,TWO HUNDRED "
40 DATA DOLLARS.
T$ requires quotes because of the colon;
N$ requires quotes because of the comma.
Page view 67
1 2 ... 63 64 65 66 67 68 69 70 71 72 73 ... 195 196

Comments to this Manuals

No comments