NMC 'foreach' primitive is yet another enhancement to quickly create high-power custom scripts, or simply execute any number of NMC commands in a loop.
nmc$ foreach var (value1, value, ...)
The 'foreach' line (above) indicates the beginning of the special 'foreach' mode. Active 'foreach' mode is denoted by (f) in the NMC prompt. While in this mode, all commands are collected for future execution - in a loop. The 'endfor' primitive indicates and end of the 'foreach' mode and triggers execution of all commands, for all values of the iterator. In the outline above, the iterator would be "var", and its values: value1, value2, etc.
For details and examples, please see:
nmc$ foreach -h