Lists
A list is an ordered collection of values. A multi-line list begins with are and ends with a period.
Otter
games are
"Zelda"
"Metroid"
"Mario"
.
An empty list is written games are empty.
Working with a list
Otter
say "Total games:" length of games
if games contains "Zelda"
say "Found Zelda in collection!"
.
add "Pokemon" to games
say "After add, count is:" length of games
remove "Metroid" from games
say "After remove, count is:" length of games
add and remove work on numbers as well as lists: on a number they do arithmetic, on a list they append and remove items.
Looking at items
Otter
say "First:" first of games
say "Last:" last of games
Walking a list
each visits every item in order. See Loops.
Next: functions