Wilson WindowWare Tech Support

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


Why use arrays

 Keywords: use of array 

Question:

For the non programmers, where can we find details about arrays and their use? It seems to be a great improvement for Winbatch but I don't have any ideas of what I would do with arrays, that I can't do with itemlists?

Answer:

One of the disadvantages of an array is the fixed size on creation. An advantage is in effect linking data together, especially with multiple dimensions.

With lists, you can use multiple delimiters and handle it that way, where each item is really multiple bits of related data. Alternately, you use multiple lists, and have to track them all.

Let's say you wanted a simple address book. There's a name, address line or two, phone number or two or three, email addresses these days, and more. You can handle each one in a separate list, since it would be really awkward to try to put it all in one mega-list, or you can use one array with 2 dimensions. X number of people by Y number of items to store should be a lot easier to work with.

One other nice little advantage is you no longer have to watch that your delimiters aren't in your items, although it was only rarely a difficulty with tabs. Debugging may be a bit easier, though there will be problems adjusting to the zero-based arrays.



Article ID:   W14570
Filename:   Why use arrays.txt