
7-6
Section
Details of BASIC Commands
139
7-6
Details of BASIC Commands
This section explicitly defines the functions, commands and statements of the BASIC
language and gives examples of their use. The conventions used to describe the syntax of
the BASIC Language are:
1.
<> Brackets in the syntax denote a term that is expanded elsewhere in the table. E.g.
<expression> means that the definition of an expression can be found elsewhere in
the table.
2.
[] Brackets surround optional items. E.g.,
pinf
[ <Program number> ] means that
the Program number is optional in the pinf command.
3.
BASIC keywords and pre-defined functions are written in boldface, e.g., in the
example above pinf is a BASIC keyword.
4.
A choice between several selections is denoted by ( ) parentheses. If parentheses are
to be entered as they are, they will be denoted by
( )
. The items to be selected are
separated by a vertical bar, | .
5.
When the differences between two selections is too great they will be shown in a
separate RHS entry.
6.
Repetition is denoted by {} brackets. Items enclosed in these brackets are repeated
zero or more times. e.g. data <data field> {, <data field>}
7.
Items enclosed in quotes, “”, should be entered as they are written.
@if
Syntax:
@
IF
<numerical expression>
THEN
[(<program>] [
ELSE
[(<program>]]
ENDIF
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 multiple line statements. @
IF
statements
can be nested.
Remarks:
The results of <numerical expression> determine which branch of the conditional statement is
executed. If the result of the <numerical expression> is non-zero (TRUE) then the statements after
THEN
are executed, otherwise the statements after
ELSE
are executed.
It is the user’s responsibility to ensure that an
ENDIF
is encountered.
If there is no
ELSE
statement then execution will continue with the next statement.
All @
IF
statements must be terminated by an
ENDIF
. If an
ENDIF
is encountered before a
corresponding @
IF
or if the program ends without encountering an
ENDIF
(if an @
IF
has already
been encountered), the “mismatch: @
IF
/
ENDIF
” error (code B029) will occur.
Examples:
> 10 A= -5
> 20 @IF A<0 THEN
> 30
B = -A
> 40
PRINT “ABS OF “; A; “ IS “; B
> 50 ELSE
> 60
PRINT “ABS OF “; A; “ IS”; A
> 70
PRINT “END”
> 80 ENDIF
> 90 END
>
RUN
ABS OF
-5
IS
5
See also:
IF
Summary of Contents for C200H-ASC11
Page 1: ...C200H ASC11 ASC21 ASC31 ASCII Units Operation Manual Revised June 2000...
Page 2: ...iv...
Page 4: ...vi...