Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand

...

borderColor#3D3D3D
bgColor#F4F4F4
titleColor#3D3D3D
borderWidth0
titleBGColor#3D3D3D
borderStylesolid

...

titleVersion 9 and Older Versions
Expand
titleTable of Contents
Table of Contents
indent20px

...

Insert excerptBrightScript Version Navigation MenuBrightScript Version Navigation Menunopanel

true

Operations in the innermost level of parentheses are performed first. Evaluation then proceeds according to the precedence in the following table. Operations on the same precedence are left-associative, except for exponentiation, which is right-associative.

Description

Symbol(s)

Function Calls or Parentheses

()

Array Operators

. , []

Exponentiation

^

Negation

–, +

Multiplication, Division, Modulus

*, /, MOD

Addition, Subtraction

+, -

Comparison

<, >, = , <>, <=, >=

Logical Negation

NOT

Logical Conjunction

AND

Logical OR

OR

String Operators: The following operators work with strings: <, >, =, <>, <=, >=, +

Function References: The = and <> operators work on variables that contain function references and function literals.

Logical and Bitwise Operators

The AND, OR, and NOT operators are used for logical (Boolean) comparisons if the arguments for these operators are Boolean:

...

When the "." Dot Operator is used on an Associative Array, it is the same as calling the Lookup() or AddReplace() methods, which are member functions of the roAssociativeArrayobject:

Code Block
aa = {}
aa.newkey = "the value"
print aa.newkey

Note that the parameters of the "." Dot Operator are set at compile time; unlike the Lookup() and AddReplace() methods, they are not dynamic.

The "." Dot Operator is always case insensitive: For example, the statement aa.NewKey=55 will create the entry "newkey" in the associative array. To generate case-sensitive keys, instantiate an roAssociativeArray object and use the SetModeCaseSensitive() method.

...

The following code snippet demonstrates the use of both array and function-call operators.

Code Block
aa = CreateObject("roAssociativeArray")
aa["newkey"] = "the value"
print aa["newkey"]

array = CreateObject("roArray", 10, true)
array[2] = "two"
print array[2]
 
fivevar = five
print fivevar()
 
array[1] = fivevar
print array[1]()   ' print 5
 
function five() As Integer
   return 5
end function

Array Dimensions

Arrays in BrightScript are one dimensional. Multi-dimensional arrays are implemented as arrays of arrays. The [ ] operator will automatically map multi-dimensionality. For example, the following two fetching expressions are the same:

Code Block
dim array[5,5,5]
item = array[1][2][3]
item = array[1,2,3]

...

note

If a multi-dimensional array grows beyond its hint size, the new entries are not automatically set to roArray.

Equals Operator

The = operator is used for both assignment and comparison:

...