• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 11. Manipulating Information > Ordering Information with Arrays

Ordering Information with Arrays

When you have many pieces of related information that you want to store, you may need to use the Array object to help arrange that information. Arrays are containers that hold data, just as variables do, except that arrays hold data in a specific sequence, called an index. The index begins at 0 and is numbered sequentially so that each piece of data corresponds to an index, as in a two-column table (Figure 11.32). Because each piece of data is ordered numerically, you can retrieve and modify the information easily—and, most important, automatically—just by referencing its index. Suppose that you’re building a foreign-language tutorial and want to search the content of a viewer’s text input for important vocabulary words. You can store those words in an array, so that index 0 holds the first vocabulary word, index 1 holds the second word, and so on. By using a looping statement, you can check the input text against each entry in the array automatically.

Figure 11.32. An array is like a two-column table with an Index column and a corresponding Value column.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint