Loop through and print each element in a collection in order.

Use your language's "for each" loop if it has one, otherwise iterate through the collection in order with some other loop.



Related tasks

   Loop over multiple arrays simultaneously
   Loops/Break
   Loops/Continue
   Loops/Do-while
   Loops/Downward for
   Loops/For
   Loops/For with a specified step
   Loops/Foreach
   Loops/Increment loop index within loop body
   Loops/Infinite
   Loops/N plus one half
   Loops/Nested
   Loops/While
   Loops/with multiple ranges
   Loops/Wrong ranges


To run:
Start up.
Create a list.
Write each entry in the list to the console.
Destroy the list.
Wait for the escape key.
Shut down.
 
An entry is a thing with a number.
 
A list is some entries.
 
To add a number to a list:
Allocate memory for an entry.
Put the number into the entry's number.
Append the entry to the list.
 
To create a list:
Add 1 to the list.
Add 2 to the list.
Add 3 to the list.
Add 6 to the list.
Add 7 to the list.
Add 9 to the list.
 
To write an entry to the console:
Convert the entry's number to a string.
Write the string to the console.
 
To write each entry in a list to the console:
Get an entry from the list.
Loop.
If the entry is nil, exit.
Write the entry to the console.
Put the entry's next into the entry.
Repeat.