Dot operator – BrightSign BrightScript 3.0 Reference Manual User Manual

Page 16

Advertising
background image

11

if a=c and not(b>40) then print "success"

On the other hand, if the arguments for these operators are numeric, they will perform bitwise operations:

x = 1 and 2 ' x is zero

y = true and false ' y is false

When the

AND or OR operator is used for a logical operation, only the necessary amount of the expression is executed.

For example, the first statement below will print "True", while the second statement will cause a runtime error (because
"invalid" is not a valid operand for

OR):

print true or invalid
print false or invalid

Dot Operator

The "

." Dot Operator can be used on any BrightScript object. It also has special meaning when used on an

roAssociativeArray object, as well as

roXMLElement and roXMLList

objects. When used on a BrightScript Object, it refers

to an interface or method associated with that object. In the following example,

IfInt refers to the interface and

SetInt() refers to a method that is part of that interface:
i=CreateObject("roInt")
i.ifInt.SetInt(5)
i.SetInt(5)

Every object method is part of an interface. However, specifying the interface with the Dot Operator is optional. If the
interface is omitted, as in the third line of the above example, each interface that is part of the object will be searched for
the specified member. If there is a naming conflict (i.e. a method with the same name appears in two interfaces), then the
interface should be specified.

Advertising