Previous Next        Current Page: NeXtMidas Training / Macros - Part 1 (Basics) / Loops and Control Structures / Loops / FORALL
back
+ Start Here   
+ Background   
+ Common Midas Concepts   
+ Getting Started - Part 1   
+ Getting Started - Part 2   
+ Working with Files   
+ Option Trees   
- Macros - Part 1 (Basics)   
   + Macro Basics   
   - Loops and Control Structures   
      - IF   
         - Tests   
         - IF (Block)   
         - IF (One-Line)   
         - IF (Quick Check)   
      - Loops   
         - DO   
         - LOOP   
         - WHILE   
         - FOREACH   
         - BREAK and CONTINUE   
         - FORALL   
         - Summary   
      - GOTO and LABEL   
      - Lab 1 - Macro Control   
         - Instructions   
         - Solution   
      - Lab 2* - Macro Control   
         - Instructions   
         - Solution   
   + Procedures and Subroutines   
   + Pipes in a Macro   
   + Messages in a Macro   
+ Macros - Part 2 (Graphics)   
+ NetBeans - Part 1 (Setup)   
+ NetBeans - Part 2 (GUIs)   
+ NetBeans - Part 3 (Profiler)   
+ Eclipse - Part 1 (Setup)   
+ Eclipse - Part 2 (GUIs)   
+ Primitives   
+ WebStart   
+ Maps & Imagery   
+ X-Midas Interoperability   
+ RMIF & Remoting   
+ Installing NeXtMidas   
+ Support & Maintenance   
+ File Handlers   


  • 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.

back