FOREACH function implements a for loop on a list or map.
For each iteration i on a list, the i-th element on the list is put on top of the stack, and the exec macro is then called.
For each iteration i on a map, the exec macro is called with the i-th value on top of the stack, and the i-th key just below on the stack.
You can start your macro with
'value' STORE 'key' STORE.
Since release 2.1,
FOREACH has the ability to iterate over Geo Time Series™ and GTS Encoders. When iterating over a GTS or Encoder, the macro is fed with a list of the form
[ tick lat lon elev value ] where
elev may be
NaN if unset. In the case of an Encoder,
value can be a byte array or a
BigDecimal on top of
Since release 2.4.0, you can force FOREACH to push an index (iteration count, start at 0) on the top of the stack before calling the macro.