This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
en:arrays [2016/05/28 03:24] junior-root |
en:arrays [2016/08/07 15:37] admin |
||
---|---|---|---|
Line 2: | Line 2: | ||
Arrays are allocated using the [[DIM|DIM]] command or re-sized using [[REDIM|REDIM]]. | Arrays are allocated using the [[DIM|DIM]] command or re-sized using [[REDIM|REDIM]]. | ||
Array sizes may also be extracted using [?] [?,] and [,?] on the end of the array variable. | Array sizes may also be extracted using [?] [?,] and [,?] on the end of the array variable. | ||
- | ==== Example | + | |
+ | ==== Assigning values to an array ==== | ||
+ | |||
+ | Values may be assigned to an array in one of four ways: | ||
+ | |||
+ | 1. By using the [[dim|Dim]] statement to reserve space for the array in the computer' | ||
< | < | ||
- | print myarray[4] | + | dim a(10) |
+ | for t = 0 to 9 | ||
+ | a[t] = t | ||
+ | next t | ||
</ | </ | ||
- | will display on the screen the fifth element in ' | ||
+ | 2. By using a [[lists|list]] to create and assign an array. | ||
+ | < | ||
+ | a = {{0, | ||
+ | </ | ||
+ | |||
+ | 3. By using the [[dim|Dim]] statement to copy an existing array into another array. | ||
+ | < | ||
+ | a = {1,2,3,4} | ||
+ | dim b = a | ||
+ | </ | ||
+ | |||
+ | 4. By using the [[explode|Explode]] or [[explodex|Explodex]] functions to split a string into an array. | ||
+ | < | ||
+ | a = explode(" | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== History ==== | ||
+ | |1.99.99.55|added dim logic to copy one array to another| |