bs Arrays

beasscript-logo-small  

Arrays are "simulated" with nested variable definitions

 

for ll_loop=to 3
  setvar=myArray[ll_loop]=<ll_loop>
next

 

this define the variables myArray1, mayArray2, myArray3

You can check the values with

 

for ll_loop=to 3
  messagebox=<myArray[ll_loop]>
next

This return 1,2 and then 3

 

You can work with Multi-Dimensions arrays

setvar=mycounter=5
setvar=mycounter2=3
setvar=myvariable[mycounter1]_[mycounter2]="Test"

 

That means that any dimensions are possible.

 

Set a variable with

setvar=myvariable[mycounter]=<value>

 

Be careful: mycounter HAS to be a variable

 

Note:

follow return same result

setvar=mycounter=1
setvar=myArray[myCounter)="Hello"
messagebox=<myArray[myCounter]>
messagebox=<myArray1>

 

Additional Example:

Set an array-variable WITHOUT counter:

No direct access possible because you have to specify a variable with [..].

Simulating array behaviour the solution is as simple as that:

 

for mycounter = 1 to 10
setvar=myvariable[mycounter]=%numadd(<mycounter>,5)
next