FruitList$(0)="apple" 'assign 2 cells of a list array FruitList$(1)="orange" dimension=dimension(FruitList$()) 'first get the dimension of the array if dimension>3 then print "Sorry, program only written for array dimensions of 3 or less." end end if call elements FruitList$(), dimension 'next get the size of each dimension end function dimension(array$()) for dimension=1 to 4 select case dimension case 1 try: x$=array$(0) catch: goto [TryNext] end try exit for case 2 try: x$=array$(0,0) catch: goto [TryNext] end try exit for case 3 try: x$=array$(0,0,0) catch: goto [TryNext] end try exit for case 4 exit for end select [TryNext] next dimension if dimension<4 then print "array dimension = "; dimension ArraySize(0)=dimension end function sub elements array$(), dimension select case dimension case 1 try do x$=array$(a) a+=1 loop catch: elements=a end try ArraySize(1)=elements-1 print "dimension 1 has "; elements; " elements (cells), "_ "numbered 0 to "; ArraySize(1) case 2 try do x$=array$(a,0) a+=1 loop catch: elements=a end try ArraySize(1)=elements-1 print "dimension 1 has "; elements; " elements (cells), "_ "numbered 0 to "; ArraySize(1) elements=0 try do x$=array$(0,b) b+=1 loop catch: elements=b end try ArraySize(2)=elements-1 print "dimension 2 has "; elements; " elements (cells), "_ "numbered 0 to "; ArraySize(2) case 3 try do x$=array$(a,0,0) a+=1 loop catch: elements=a end try ArraySize(1)=elements-1 print "dimension 1 has "; elements; " elements (cells), "_ "numbered 0 to "; ArraySize(1) elements=0 try do x$=array$(0,b,0) b+=1 loop catch: elements=b end try ArraySize(2)=elements-1 print "dimension 2 has "; elements; " elements (cells), "_ "numbered 0 to "; ArraySize(2) elements=0 try do x$=array$(0,0,c) c+=1 loop catch: elements=c end try ArraySize(3)=elements-1 print "dimension 3 has "; elements; " elements (cells), "_ "numbered 0 to "; ArraySize(3) end select 'print the explicit or implied DIMension statement for this array print "DIM array$("; a-1; if b>0 then print ","; b-1; if c>0 then print ","; c-1; print ")" end sub