OWBasic for Pocketviewer

Home INTRO Group ARRAY Alphabetical Index

Size of an Array

ARRAYSIZE(array)
ARRAYSIZE(array,mode)

The function returns the index of the last element of an array of an arbitrary typ. Normally the last index of an equivalent one dimensional array is return. With different values of mode one can get the index of the last row index or the last column.
DIMarraysize(a)arraysize(a,1)arraysize(a,2)
(no DIM)000
DIM a[5]550
DIM a[3,4]1934

This function is especially useful in procedures, where the size of an array, given as parameter, may differ:

proc setarray var a[],val
for i=0 to arraysize(a)
a[i]=val
next
endp


Home INTRO Group ARRAY Alphabetical Index