Current Page: NeXtMidas Training Macros - Part 1 (Basics) Loops and Control Structures Loops FORALL
- - | The `FORALL` Loop: The `FORALL` loop is a very simple one-line loop. The pound sign (`#`) is a special character representing the current iteration value.
        forall #=<start>:<end>;<inc> <command>
  For example:
      res n 0
      forall #=1:21;2 calc n n # +
- There are variants of the `FORALL` that can be used to iterate over the elements of a file.
      files/f t* ,,1
      forall FILES status #
Since `FORALL` is implemented via a macro it has a number of unusual restrictions related to result translation and which commands can be called. See the `FORALL` explain file for details. The `FORALL` is the least-frequently-used loop in NeXtMidas. This is primarially because `DO` and `FOREACH` are more flexible and provide similar functionality.
X-Midas Users Take Note:
Like NeXtMidas, X-Midas implements `FORALL` via a macro and has similar restrictions on how it can be used.