beautypg.com

Commands and functions, Arraydim (array), Arraysize (array, number) – Xylem STORM 3 Basic Programming manual User Manual

Page 12: Asc (string)

background image

COMMANDS AND FUNCTIONS

10

Single-dimensional array:

ARRAY myArray(5)

FOR i = 1 TO 5

myArray(i) = i * 2 REM Duplicate the number’s value inside the array

NEXT i

REM myArray(i) now contains values 2 4 6 8 10

Multi-dimensional array:


ARRAY myArray$(3,7) REM 2-dimensional string array (3 rows, 7 columns)

FOR i = 1 TO 3

FOR j = 1 TO 7

myArray$(i,j) = str$(i * j) REM str$ converts a number to a string

NEXT j

NEXT i

REM myArray$(i,j) now contains values 1 2 3 4 5 6 7

2 4 6 8 10 12 14

3 6 9 12 15 18 21

Returns the given array’s number of dimensions.

ARRAY arr(10)

var = ARRAYDIM(arr()) REM sets var to 1 as arr is one-dimensional

ARRAY myArr(2,4,4)

var = ARRAYDIM(myArr()) REM sets var to 3 as myArr is three-dimensional

ARRAYDIM (array)

Returns the given array’s dimension’s size, where array specifies the array and number specifies the

dimension. The last parameter is optional and defaults to the first dimension if not specified.

ARRAY myArray(10)

var = ARRAYSIZE(myArray()) REM sets var to10

ARRAY myArr$(2,4)

var = ARRAYSIZE(myArr$(), 2) REM sets var to4

ARRAYSIZE (array, number)

Returns the first character’s ASCII numerical representation. CHR$( ), converting a numerical value

to the ASCII character, is the opposite function of ASC( ).

var = ASC(“A”) REM sets var to 65

var$ = CHR$(65) REM sets var$ toA

ASC (string)