Chapter 11

Interacting with Arrays

You look in a filing cabinet drawer and see multiple file folders inside. Some of them contain a lot of information, some of them a little—a few contain nothing at all. The file folders are individual containers used to hold something—it doesn't matter what that something is, just that the storage capability exists. The need for filing cabinet drawers with all of those file folders is real—can you imagine the chaos that would result if they didn't exist? Civilization as we know it might cease to exist!

Programs also have a need for organized data storage—a filing cabinet drawer of sorts—and inside that data storage are little containers—a sort of file folder. These cabinet drawers come in two forms: arrays and collections. IDEAScript only supports arrays, so that's what this chapter discusses. However, you may encounter collections when interacting with other applications through IDEAScript, so it's important to remember the term.

imgNote

Arrays are the simpler of the two storage techniques and you normally use them for general storage. For example, you can use an array to store a group of related numbers. A collection normally provides additional functionality, but it's usually attached to a specific object and can prove more difficult to use. Work with collections when the object provides the functionality for you.

Arrays provide simple storage ...

Get Mastering IDEAScript: The Definitive Guide, with Website now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.