Programming Statements

Nesting Modules

You can nest one module within another. You must make sure that each nested module is completely contained inside the parent module. Each module is collected independently of the others. When you nest modules, it is a good idea to indent the statements relative to the nesting level, as shown in the following example:

  
    start a; 
       reset print; 
       start b; 
          a=a+1; 
       finish b; 
       run b; 
    finish a; 
    run a;
 

In this example, IML starts collecting statements for a module called A. In the middle of this module, it recognizes the start of a new module called B. It saves its current work on A and collects B until encountering the first FINISH statement. It then finishes collecting A. Thus, it behaves the same as if B were collected before A, as follows:

  
    start b; 
       a=a+1; 
    finish; 
    start a; 
       reset print; 
       run b; 
    finish; 
    run a;
 

Previous Page | Next Page | Top of Page