Relational operators allowed in uBasic are:
= (equals)
> (greater than)
< (less than)
<> (not equal)
<= (less than or equal)
>= (greater than or equal)
It is possible, too, to connect several conditions using the operators and, or,
xor, and not. Parentheses may be used to indicate which operators are ex-
ecuted first:
if (a = 1 or a = 2) and b < 0 then ...
If there is nothing to do in the else case, the else clause can be omitted:
b = 4
if a < 0 then
b = 3
endif
does just the same and runs faster because each program line in uBasic
involves a delay of 10 msec.
In simple cases, it is possible to combine all of these statements into
one line and omit the endif:
if a < 0 then b = 3 else b = 4
or
b = 4
if a < 0 then b = 3
Here, the second version is slower because it needs two lines of code.
Note: This shorthand notation without an endif can, however, only be
used standalone and not nested inside another if ... then ... else ...
endif construct. In this latter case, you must use the full statement prop-
erly closed with endif.
5.3.5 Case structures
The select statement is a convenient way to avoid complex if ... then
... else constructs. It allows executing different statements depending
on the value of a variable:
5.3 uBasic primer
87