Array literals, Assoiative array literals – BrightSign BrightScript 3.0 Reference Manual User Manual

Page 12

Advertising
background image

7

Type Float: A number with a decimal (e.g.

2.01), in scientific notation (e.g. 1.23456E+30), or with a Float type

designator (e.g.

2!)

Type Double: A number in scientific notation containing a double-precision exponent symbol (e.g.

1.23456789D-

12) or with a Double type declaration (e.g. 2.3#)

Type Function: Similar to variable formatting (e.g.

MyFunction)

Type Integer: LINE_NUM – The current source line number

Array Literals

The Array Operator (

[])can be used to declare an array. It can contain literals (constants) or expressions.


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

Assoiative Array Literals

The Associative Array Operator (

{}) can be used to define an associative array. It can contain literals (constants) or

expressions.

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

Arrays and associative arrays can also be defined with the following format:
aa = {
Myfunc1: aFunction
Myval1 : "the value"
}

Advertising