Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Accessing Multidimensional Arrays

Keywords: 	  Accessing multidimensional arrays 

Question:

Sorry to bother you with a stupid question, but I could'nt find any example to access an array say of three dimensions. The first dimension is explained in the example, but how do I access for example the items in dimension 3?
for x=0 to boondary
message("",[0,0,x])
next

???
For the time I use a really time/memory consuming workaround by taking the items one by one.

Answer:




MyArray=ArrDimension(3,4,5)  ; 3*4*5 or 60 elements

;loading array
For aa=0 To 2
   For bb=0 To 3
       For cc=0 To 4
          MyArray[aa,bb,cc] = aa*20 + bb*5 + cc
       Next
   Next
Next

;Displaying Contents

For aa=0 To 2
   For bb=0 To 3
       For cc=0 To 4
          Pause( StrCat("MyArray[",aa,",",bb,",",cc,"]"), MyArray[aa,bb,cc])
       Next
   Next
Next

Message("App","Done")