beautypg.com

Program statements, Dim name (dim1, dim2, …, dimk), Variable = expression – BrightSign BrightScript 2 Reference Guide User Manual

Page 24

background image

24

Program Statements

DIM name (dim1, dim2, …, dimK)

DIM (“dimension”) is a statement that provides a short cut to creating roArray objects. It
sets variable name to type “roArray”, and creates Array‟s of Array‟s as needed for multi-
dimensional arrays. The dimension passed to Dim is the index of the maximum entry to
be allocated (the array initial size = dimension+1); the array will be resized larger
automatically if needed.

Dim array[5]


Is the same as:

array=CreateObject(“roArray”,6,true)

Note that x[a,b] is the same as x[a][b]

Another example:

Dim c[5, 4, 6]

For x = 1 To 5
For y = 1 To 4
For z = 1 To 6
c[x, y, z] = k
k = k + 1
Next
Next
Next

k=0
For x = 1 To 5
For y = 1 To 4
For z = 1 To 6
If c[x, y, z] <> k Then print"error" : Stop
if c[x][y][z] <> k then print "error":stop
k = k + 1
Next
Next
Next

variable = expression

Assigns a variable to a new value.

Examples:

a$="a rose is a rose"
b1=1.23
x=x-z1