6.3.4 Iterating over lists

The foreach command can be used to iterate over the members of a list; it will be covered in more detail in Section 7.3. The following example iterates over the words in a sentence:

pyxplot> poem = "An aged thrush, frail, gaunt, and small, "
pyxplot> poem+= "In blast-beruffled plume"
pyxplot> wordList = poem.split()
pyxplot> foreach word in wordList { print word ; }
An
aged
thrush,
frail,
gaunt,
and
small,
In
blast-beruffled
plume