OWBasic for Pocketviewer

Home INTRO Group VARIABLES Alphabetical Index

Array declarations

DIM <identifier>[<last>]
DIM <identifier>[<last_row>,<last_column>]

Arrays are defined with DIM instruction. The index for the access to elements of the array is an integer value and is always indicated with square brackets.
Definition of one-dimensional arrays requires one parameter, which is the last allowed index. The array contains last+1 elements.
Definition of two-dimensional arrays requires two parameters, which are the index of the last row and the last column. The array contains (last_row+1) rows and (last_column+1) columns.
It is not possible to change field sizes at runtime.
Simple variables, variables not declared with dim, are equivalent to an array with one element (last=0).
One-dimensional arrays are equivalent to twodimensional arrays with one column (last_column=0).
Two-dimensional arrays can also be addressed like one-dimensional arrays with last=(last_row+1)*(last_column+1)-1.
At runtime the size of an one-dimensional array can be determined with the function arraysize.

Example:
DIM a#[100] : ! Floating point array with 101 elements (index : 0..100)
FOR i=0 to 100
 a#[i]=FLOAT(i)*3.14
NEXT


  • CONST - Constants and Initialized Arrays
  • ARRAYPARA - Arrays as procedure parameters
Home INTRO Group VARIABLES Alphabetical Index