Lists: A list is a collection of items each identified by their numeric position in the list (starting with zero)

For Example: A shopping list is a list that we use everyday.


Ask yourself and then answer the following questions:

1. What is item 1?

2. What is item 2? 3. What is the length of the list?

      • These may seem like simple questions but this is how the computer and your App will think.

What can we do with lists?

1. Add an item
2. Remove an item
3. Ask if the list is empty
4. Reorder the list
5. Insert an item into the list
6. Ask if an item is on the list
7. Remove duplicates.
***In the app Positive Self Talk we will use a list to hold a series of images and messages to be randomly displayed on the screen.

Lists in App Inventor

To make a list in App Inventor we first must create a variable.

Note the Variable in this example is labeled messages, the blue block is my list. And attached to my list are TextArguments.

Another option is to first create a variable that will make a list.

***Note this Variable is called ExcuseList

And then we would need to define the list.

***Here we are are setting the ExcuseList variable to Make a list which contains a list of excuses.

To use the items in the list we will need to use a set block. In the example below we use a set.Text which means that we are setting the text to a component using the text in our list.

***Note we also need to use the list block "select list item." This block asks for two items: list and index. The list is asking for the name of the list and the index is asking for the item in the list. So in this case we are asking for the 2nd item in the ExcuseList.

In more complicated Apps we will need to learn to control the index.