Sharp PC-1403 Operation Manual page 153

Hide thumbs Also See for PC-1403:
Table of Contents

Advertisement

147
This program continues to ask 'CONTINUE?'
as long
as 'YES'
is
entered;
it
stops
if
'NO'
is
entered,
and complains otherwise.
10
INPUT
"CONTINUE?"; A$
20
IF
A$="YES"
THEN GOTO 10
30 IF A$="NO"
THEN
GOTO 60
40 PRINT "YES
OR
NO, PLEASE"
50
END
Examples
The
statement which follows the
THEN
may
be any
BASIC
statement,
including
another IF
... THEN,
If it is
a
LET
statement,
the LET verb
itself
must appear.
The two
formats
of
the IF statement are
identical
in
action,
but the first format is
clear.
*
1
#1
In
the normal running of BASIC programs,
statements
are
executed in the sequence in
which they
occur.
The IF ...
THEN
verb
pair
allows
decisions
to be
made
during
execution so
that
a given statement
is
executed
only
when
desi
r
ed.
When
the
condition
part of
the
IF
statement
is
true,
the
statement
is
executed;
when it is false, the
statement is
skipped.
The condition part of the IF statement
can be any
relational
expression as described in
Chapter 4. It is also possible to use a
numeric
expression as a condition,
although
the
intent of the statement
will
be less
clear. Any
expression which evaluates to zero or a
negative
number is considered false;
any which eval
u ates to a positive
number is
consi
d
ered true.
•A!IM·Mi
The IF
...
THEN verb
pair is
used
to execute
or
not
to
execute
a statement
depending
on
conditions
at the time the program is
run.
Abbreviations: none
for IF; T, TH.,
THE.
1
IF
condition
THEN
statement
2
JF
condition statement
Verbs
IF ... THEN

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents