Foreach

foreach [<variable>(:<variable>)] [in] [<list/map>]

repeats a block of commands for every entry in a collection with a variable to read the current entry.

Parameters:

  1. The variable to put the current entry that is the block of script is being executed for in. If the input is a map instead of a list, a second variable can be specified for storing the value of the map entry at the current iteration.
  2. Required literal ‘in’ text.
  3. The list or map to perform the foreach on.