The OPTMODEL Procedure

STOP Statement

STOP ;

The STOP statement halts the execution of all statements that contain it, including DO statements and other control or looping statements. Execution continues with the next top-level source statement. The following code demonstrates a simple use of the STOP statement:

    proc optmodel;                                                                                                                          
       number i, j;                                                                                                                         
       do i = 1..5;                                                                                                                         
          do j = 1..4;                                                                                                                      
             if i = 3 and j = 2 then stop;                                                                                                  
          end;                                                                                                                              
       end;                                                                                                                                 
       print i j;
 

The output is shown in Output 6.28.

The OPTMODEL Procedure

i j
3 2


Figure 6.28: STOP Statement: Output

When the counters i and j reach 3 and 2, respectively, the STOP statement terminates both loops. Execution continues with the PRINT statement.

Previous Page | Next Page | Top of Page