Skip to Main Content
App Inventor
book

App Inventor

by David Wolber, Hal Abelson, Ellen Spertus, Liz Looney
May 2011
Beginner to intermediate content levelBeginner to intermediate
386 pages
11h 41m
English
O'Reilly Media, Inc.
Content preview from App Inventor

Chapter 19. Programming Lists of Data

image with no caption

As you’ve already seen, apps handle events and make decisions; such processing is fundamental to computing. But the other fundamental part of an app is its data—the information it processes. An app’s data is rarely restricted to single memory slots such as the score of a game. More often, it consists of complex, interrelated items that must be organized just as carefully as the app’s functionality.

In this chapter, we’ll examine the way App Inventor handles data. You’ll learn the fundamentals of programming both static lists (in which the data doesn’t change) and dynamic lists (in which the data is user-generated). Then you’ll learn how to deal with even more complex data involving lists whose items are also lists.

Many apps process lists of data. For example, Facebook processes your list of friends. A quiz app works with a list of questions and answers. A game might have a list of characters or all-time high scores.

List variables work like text and number variables you’ve worked with, but instead of the variable representing a single named memory cell, it represents a related set of memory cells. Consider, for example, the list of phone numbers in Table 19-1.

Table 19-1. A list variable represents a set of memory cells

111–2222

333–4444

555–6666

The elements of a list are accessed using an index. An index is a position in a list, so index 1 of the list ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hello App Inventor!

Hello App Inventor!

Carl Simmons, Paula Beer
App Inventor 2 Essentials

App Inventor 2 Essentials

Felicia Kamriani, Krishnendu Roy
App Inventor 2, 2nd Edition

App Inventor 2, 2nd Edition

David Wolber, Hal Abelson, Ellen Spertus, Liz Looney

Publisher Resources

ISBN: 9781449306786Supplemental ContentErrata Page