Previous Next        Current Page: NeXtMidas Training / Macros - Part 1 (Basics) / Loops and Control Structures / IF / IF (Block)
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   


  • Block IF:
    • A block IF starts with an IF <test> THEN line and ends with an ENDIF line.
      if value LT 0 then
        say "the value is negative"
      endif
    • The block IF can also have an ELSE clause that is executed when the test is false.
      if value LT 0 then
        say "the value is negative"
      else
        say "the value is not negative"
      endif
    • The block IF can have one or more ELSEIF blocks that test for other other conditions when the previous one(s) have not been satisfied.
      if value LT 0 then
        say "the value is negative"
      elseif value EQ 0 then
        say "the value is zero"
      else
        say "the value is positive"
      endif
    • The use of THEN is technically optional, but is strongly recommended.

back