Language Elements |
Logical Operators
The logical operators NOT, AND, OR, XOR, IMP, and EQV are operators that compare the nth bit of argument X with the nth bit of argument Y. They are evaluated after the arithmetic and relational operators; therefore, arithmetic expres- sions resolve to a number which is compared with another number. A relational operator test can be used with logical operations. If there are two logical operators of the same precedence in a single expression, they are evaluated left to right. Table
IF A>=3.5X OR X > 3 THEN 01=0
IF B=1 OR B=2 OR B=3 THEN 2750 ELSE 280u
IF
String Operator
The relational operators may be used with strings to compare them according to ASCII order. If strings of unequal length are compared, and the shorter is identical to the first part of the longer, then the longer is greater. There is one operator only used with strings: the concatenation operator (+). This operator defines a string as two or more strings joined together.
A$ = B$+C$
Expressions
Except for the command and stateqlent instructions, all of the language elements previously discussed can be combined to form expressions. Depending on the type of constants, variables, and operators used, expressions can be classed as numeric or string.
Numeric Expressions
In
Any function which returns a numeric value can be used in a numeric expression. Strings can only be used if they are converted to a number. Numeric expressions can use arithmetic, logical, or relational operators. Some numeric expressions:
K(I) = B*SOR(X)
IF A>12.1 THEN C = C + 1
IF PEEK (2FFFH) AND OCH THEN PRINT "ON"
String Expressions
String expressions can be specified in
A$ = "NAME:" + NAME$
IF B1$>R$ THEN 81$ = ""
R$(I)=R$(I) + S$(I) + "DONE"