EasyManua.ls Logo

Radio Shack TRS-80 - Page 173

Radio Shack TRS-80
236 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...
c.
Did
you
tell
the
Computer
to
divide
by zero? (The Computer isn't about to let you get
away
with
that one!)
To
find
out
whether you did
any of
these things,
PRINT the values
for all the variables
used
in
the
offending line. If you still don't see the error, try carrying
out
the operations
indicated
on
the line. For example, the error may
occur
during
a multiplication of two
very large numbers.
These certainly aren't
all the possible
errors one
can make, but at least they give you some
idea
where to look first. Since we can't completely avoid silly errors,
it's necessary
to be
able to recover from
them as
quickly
as possible.
By the way ... a
one-semester course in beginning typing
can
do wonders for your program-
ming speed and typing
accuracy.
From the Ridiculous to the Sublime:
All the Computer can tell us is that we have (or have not) followed all of its rules. Assuming
we have followed all the rules, the Computer will not ask "WHAT?" or "HOW?"
even
if we're asking it to do
something
that's quite
silly
and isn't at all what we intended. It will
dutifully
put
out
garbage all
day
long if
we
feed it garbage
even though
we
follow its
rules. Remember
GIGO?
If the program has
no
obvious errors,
what
might
be
the
matter?
Typical "unreported" errors are:
1. Forgetting to initialize variables (and they are starting out with old values). Remember
you cannot assume that unused variables are zero.
2. Accidentally reinitializing a variable
particularly
easy when using loops.
Example:
10
FOR
N=l TO 3
20 READ A
30
PRINT
A
40 RESTORE
50
NEXT N
60 DATA
1,2,3
3. Reversing conditions, i.e.
using
"="
when
you mean
"<$\
or "greater than" when you
mean
"less
than."
?RiNT
:
ifi
:
caicu^ferme^:(fi
mm::"-.-
171

Other manuals for Radio Shack TRS-80

Related product manuals