
7-6
Section
Details of BASIC Commands
162
if
Syntax:
IF
<numerical expression> (
THEN
[(<statement> {: <statement>} | <line number> | <label>)] |
GOTO
(<line number> | <label>)) [
ELSE
[(<statement> {: <statement>} | <line number> |
<label>)]]
Description:
Statement. Controls the flow of a program based on the results of a numerical expression. This
statement differs from the @
IF
statement in that it supports statements only on a single line.
Remarks:
The results of <numerical expression> determine which branch of the conditional statement is
executed. If the result of the <numerical expression> is not zero then the statements after
THEN
are executed, otherwise the statements after
ELSE
are executed.
<label> is a BASIC program label. It references a line number somewhere in the BASIC
program.
If there is no
ELSE
statement then execution will continue with the next statement.
If a valid line number is used instead of statements after the
THEN
or
ELSE
clauses then execution
will continue at the specified line number. The
GOTO
statement can be used in conjunction with a
valid line number for the same purpose.
Nesting of IF statements is limited only by the length of the line. The IF statements must fit in
one line.
Examples:
> 10 A = 3
> 20 IF A=2 THEN PRINT A IS 2” ELSE PRINT “A IS NOT 2”
> RUN
A IS NOT 2
See also:
@
IF
inkey$
Syntax:
INKEY
$ [#<port expression>]
Description:
Function Returns the next character in the specified port buffer.
If the specified port buffer is empty, a
NULL
string is returned. Any character, except
CTRL
-
X
, can
be returned by
INKEY
$
Remarks:
Note:
1.
If the port expression is not specified the terminal port is default.
Examples:
> 10 IF INKEY$ <> "Q" GOTO 10
> 20 PRINT "QUIT!"
> 30 END
See also:
Содержание C200H-ASC11
Страница 1: ...C200H ASC11 ASC21 ASC31 ASCII Units Operation Manual Revised June 2000...
Страница 2: ...iv...
Страница 4: ...vi...