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


>> blk: ["John" 23 "dave" 30 "bob" 20 "Jeff" 40]
>> foreach item blk [print item]
John
23
dave
30
bob
20
Jeff
40
>>  foreach [name age] blk [print [name "is" age "years old"]]
John is 23 years old
dave is 30 years old
bob is 20 years old
Jeff is 40 years old
 
>> forall blk [print blk]
John 23 dave 30 bob 20 Jeff 40
23 dave 30 bob 20 Jeff 40
dave 30 bob 20 Jeff 40
30 bob 20 Jeff 40
bob 20 Jeff 40
20 Jeff 40
Jeff 40
40