ExitProgram Statement

Version 5

Exit the current Program.

Syntax

ExitProgram

Comments

The statement is used to exit the current Program. The statement can be only be called while a program in running. If the statement is used while executing a Test OnEndTest, than OnEndTask and than OnEnd  (program) and OnEndProgram (for system and drivers) will be called before the program exit. If called while running OnEndTest than OnEndTask and OnEnd/OnEndProgram will be called.  If called while running OnEndTask than only the OnEnd/OnEndProgram will be called. ExitProgram statement could be used in a procedure called from a program to end the current program. To Skip OnEndXXX events you can use the Task statement with -1 as a task number (i.e. Task -1).

This statement behaves exactly same as Task EndEvents -1.

A run-time error is generated if no program is currently running, for example, performing Debug Doit on statements in a test when no program was running.

Example

If TestStatus=Fail

ExitProgram

endif

See Also

ExitTask Statement, ExitTest Statement, OnEnd, OnEndProgram, OnTaskEnd, OnTestEnd, Task Statement, Test Statement, Run Statement, Program Variable