User Tools

Site Tools


en:arrays

This is an old revision of the document!


Arrays

Arrays are allocated using the DIM command or re-sized using REDIM. They may hold numeric or string data. Access to specific elements in an array is accomplished by using square brackets along with the integer offset of the element, starting from zero. Arrays may also be dimensioned and accessed using two dimensions.
Array sizes may also be extracted using [?] [?,] and [,?] on the end of the array variable.

Assigning values to an array

Values may be assigned to an array in one of four ways:

1. By using the Dim statement to reserve space for the array in the computer's memory and then assigning each individual element.

dim a(10)
for t = 0 to 9
    a[t] = t
next t

2. By using a list to create and assign an array.

a = {{0,1,2},{3,4,5},{6,7,8}}

3. By using the Dim statement to copy an existing array into another array.

a = {1,2,3,4}
dim b = a

4. By using the Explode or Explodex functions to split a string into an array.

a = explode("how now brown cow"," ")

History

1.99.99.55added dim logic to copy one array to another
en/arrays.1470605867.txt.gz · Last modified: 2020/02/28 10:46 (external edit)