STOP

<< Click to Display Table of Contents >>

Navigation:  Gekko User Manual > Gekko statements >

STOP

Previous pageReturn to chapter overviewNext page

The STOP statement will abort from all called program files/procedures/functions, without executing anything more after the STOP (this is not necessarily the case regarding RETURN). Therefore, STOP can be practical for debugging, making it possible to inspect variables at that particular point of execution. After a STOP, Gekko will show the "call stack", showing where the STOP statement was encountered.

 

To stop/abort a program while it is running, you may use the red stop button in the user interface.

 

 


 

Syntax

 

stop ;

 

 


 

Example

 

To see how STOP works, try creating the two program files file1.gcm and file2.gcm as shown below. Then call the first one of these from the statement prompt with RUN file1;. After this, Gekko will report that the program has been stopped in line 2 of file2.gcm, and that file2.gcm is called from file1.gcm. Next, if you issue a prt %i;, the value will be 1001, because the third lines of file1.gcm and file2.gcm are never executed. With a RETURN instead of a STOP in file2.gcm, the value of %i would be 1101, because the third line of file1.gcm would still have been executed.

 

------------- file1.gcm --------------
%= 1000;
run file2;
%= %+ 100;
--------------------------------------
 
------------- file2.gcm --------------
%= %+ 1;
stop;
%= %+ 10;
--------------------------------------
 
run file1;
prt %i;

 

 


 

Note

 

The similar RETURN statement does not return from all program files/procedures/functions.

The EXIT statement effectively issues a STOP, and then afterwards closes the Gekko application.

 

 


 

Related statements

 

RETURN, EXIT