BrightSign BrightScript 3.0 Reference Manual User Manual

Page 9

Advertising
background image

4

A variable that does not end in a type declaration may change its type dynamically. For example, the statement

a=4 will

create an integer, while a following statement specifying that

a="hello" will change the type of the variable a to a string.


BrightScript supports the following types:

Boolean: True or False

Integer: A 32-bit signed integer number

Float: The smallest floating point number format supported by either the hardware or software

Double: The largest floating point number format supported by either the hardware or software. Although Double is
an intrinsically understood type, it is implemented internally with the roIntrinsicDouble object. As a general rule, this
type is hidden from developers.

String: A sequence of ASCII (not UTF-8) characters. BrightScript uses two intrinsic string states:

o Constant strings: A statement such as s="astring" will create an intrinsic constant string.
o roString instances: Once a string is used in an expression, it becomes an roString instance. For example,

the statement

s = s + "bstring" will cause the intrinsic string s to convert to an roString instance. If this

is followed by the statement

s2 = s, the s2 value will be a reference to s, not a copy of it. The behavior of

reference counting strings is new to BrightScript version 3.0.

Object: A reference to a BrightScript object (i.e. a native component). Note that the

type() function will not return

"Object" but the type of object instead (e.g. roList, roVideoPlayer). Also note that there is no separate type for
intrinsic BrightScript Objects. All intrinsic BrightScript Objects are built on the roAssociativeArray object type.

Interface: An interface in a BrightScript Object. If a Dot Operator

"." is used on an interface type, the member

must be static (since there is no object context).

Invalid: A type that can have only one value:

Invalid. This type is returned in various instances when no other

type is valid (for example, when indexing an array that has never been sent).

Example
The following are examples of different types. The

? statement is a shortcut for print, while the type() function returns

a string that identifies the type of the passed expression.

Advertising