EasyManua.ls Logo

Radio Shack TRS-80 Model 100 - Page 73

Radio Shack TRS-80 Model 100
210 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...
Line
18
The left two characters
of
DATE$ are stored in the string variable MM$. This
is
the month. For example,
if
the month
is
OCTOBER, then
MM$
will have the string
"10"
assigned to it. It
is
important
to
remember that LEFT$ returns a string, not a
numeric constant.
Line
28 The string stored in
MM$
is
converted
to
a numeric constant
by
the VAL
function. This must be done because it will
be
necessary to compare the month
number
to
another numeric constant in line 50.
Line 38
The next month is read from the DATA statements and placed in MM$. The
fIrst time, JANUARY is assigned
to
MM$. Since the string originally stored in
MM$
will no longer be needed, the string variable MM$
is
reused in this line.
Line
48 This line increments a counter CT. After the first month is read, CT
w~ll
have
the value 1 because the computer initializes all numeric variables to zero when the
program is executed.
Line
58
If
the counter CT is less than the number
of
the current month; then the
program will jump back to line
30, where the next month is read from the data list.
Eventually, CT will equal MM. When this happens,
MM$
will have the current month
assigned
to
it and line 60 will be executed next. Thus, the months
are
read repeatedly
into MM$, until the present month
is
reached, and then the program jumps out of the
loop (lines
30, 40 and 50).
Line
68 The MID$ function is used to extract the day from DATE$. The day is given
by
the 4th and 5th characters of the string stored in DATE$.
Line
78 The RIGHT$ function
is
used
to
obtain the current year from DATE$. Recall
that the year is given by the last two characters.
Line
88
The date is printed in this line. Note that each item in the print list
is
followed
by
a semicolon which means that no columns are
to
be skipped.
It
was
necessary
to
print a blank space after the month, or otherwise the day would be
printed immediately after the month.
Lines
98 - 118 These DATA statements contain the months of the year which are read
by the READ statement in line
30.
What you have learned:
In this lesson the three special string functions DAY$, TIME$, DATE$ and some of
their uses have been illustrated. Various other string functions have been used
to
extract information from string variables and
to
print out certain string quantities.
67

Other manuals for Radio Shack TRS-80 Model 100

Related product manuals