beautypg.com

BrightSign BrightScript 2 Reference Guide User Manual

Page 9

background image

9

Type Invalid: invalid
Type String: String in quotes, eg “this is a string”
Type Integer: Hex integer, eg. &HFF, or decimal integer, eg. 255
Type Float: e.g., 2.01 or

1.23456E+30 or 2!

Type Double: eg,

1.23456789D-12, or .2.3#

Type BrSub , eg: MyFunction
Type Integer: LINE_NUM – the current source line number.

The following rules determine how integers, doubles, and floats are determined:

1. If a constant contains 10 or more digits, or if D is used in the exponent, that

number is double precision. Adding a # declaration character also forces a
constant to be double precision.

2. If the number is not double-precision, and if it contains a decimal point, then the

number is float. If the number is expressed in exponential notation with E
preceding the exponent, the number is float.

3. If neither of the above is true of the constant, then it is an integer.


Array “literal”
The Array Operator [ ] can be used to declare an array. It may contain literals
(constants), or expressions. E.g:

Myarray = []
Myarray = [ 1, 2, 3]
Myarray = [ x+5, true, 1<>2, [“a”,”b”]]

Associative Array Literal
The { } operator can be used to define an Associative Array. It can contain literals or
expressions. E.g:


aa={ }
aa={key1:”value”, key2: 55, key3: 5+3 }

Both Arrays and Associative Arrays can also have this form:

aa = {
Myfunc1: aFunction
Myval1 : “the value”
}

Note on Invalid vs. Object
Certain functions that return objects can also return invalid (for example, in the case
when there is no object to return). In which case, the variable accepting the result must
be dynamic, since it may get “invalid” or it may get an “object”.

l=[]
a$=l.pop()