# Array Operations

Normally operations apply only to single values, so a+b expresses the addition of two numbers. Normally adding two arrays requires indexing and looping:

110 For i=0 to N

120 For j=0 to N

130 A(J,I) = A(J,I) + B(J,I)

140 Next j

150 Next i

This need to loop and index to perform operations on arrays is both tedious and error prone.

But in this version of Basic you can simply add the arrays together.

A() = A() + B()

The single line of code above performs the same function as the double loop, only much faster.

Entire arrays can be initialized in a single line.

A() = 10

Here every element of A() is set to 10.

Array operations can get as complex as you need.

A() = A() * B() / C() + 0.5

A() = A() + 0.5

A() = 0.5 + A()

## For example:

Dim a(0)

Dim b(10000)

b() = 256

a() = b()

Now a() will have the same dimensions as b() and will contain same values as b().

## Available operators

 ^ (exponent) * (multiplication) / (division) + (addition) - (subtraction) % (remainder) mod (modulus) & (bitwise and) | (bitwise or) || (bitwise xor) ~ (bitwise not) << (shift left) >> (shift right signed) >>> (shift right unsigned)

## Operator precedence(highest to lowest)

 ( ) functions(x) -{unary minus} ^ * / % mod + - & | || << >> >>>