| **Navigation:**  [[introduction.htm|Language Reference]] > 13 - Built-in Functions >====== SHUTDOWN (arm termination procedure) ====== | [[show write to screen .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[sin return sine .htm|{{btn_next_n.gif|Next page}}]] | | || **SHUTDOWN(**[//procedure//]**)** {{blk2blue.jpg|blk2blue.jpg}} | **SHUTDOWN** | Arms a procedure which is called when the program terminates. | | //procedure// | The label of a PROCEDURE. If omitted, the **SHUTDOWN** process is disarmed. | The **SHUTDOWN** statement arms a //procedure// which is called when the program terminates. The shutdown //procedure// is called by normal program termination or by an abnormal-end/run-time halt. It may not be able to execute for an abnormal-end/run-time halt, depending upon the state of the system resources at the time of the crash. It is not called if the computer is rebooted or the program is terminated due to power failure. The same effect as SHUTDOWN can be more safely achieved by simply calling a procedure to execute on EVENT:CloseDown for the application frame. **Example:** **SHUTDOWN(CloseSys)        !Arm CloseSys as the shutdown procedure** **See Also:** [[halt exit program .htm|HALT]] [[return return to caller .htm|RETURN]]