Logical operators, Hex and octal – BrightSign HD2000 BrightScript Reference Guide User Manual

Page 11

Advertising
background image

11

Not including the built-in string functions, there is only one string operation - concatenation, represented by
the plus symbol +.

Example Programs:
A$="A ROSE"
B$=" IS A ROSE"
C$=A$+B$+B$+B$+".'
PRINT C$
RUN
A ROSE IS A ROSE IS A ROSE IS A ROSE.

Logical Operators

We described how AND, OR and NOT can be used with relational expressions. For example,


100 IF A=C AND NOT(B>40) THEN 60 ELSE 50

AND, OR and NOT can also be used for bit manipulation, bitwise comparisons, and Boolean operations.
AND, OR and NOT convert their arguments to 32-bit, signed two's-complement integers. They then perform
the specified logical operation on them and return a result within the same range

The operations are performed in bitwise fashion; this means that each bit of the result is obtained by
examining the bit in the same position for each argument.

63 AND 16 = 16
-1 OR -2 = -1

Hex and Octal

Hex and octal constants use the following prefixes:
&H (hex constants)
&O (octal constants)

Example:
PRINT &H0ABC
RUN
2748

Advertising
This manual is related to the following products: