Exit Statement

The exit statement can be placed anywhere in a script but it is inferred to be the last line of the Main: code segment. The following examples illustrate how exit can be used to force termination of a script:

Main:

   IF ($script.done)

      exit

   ELSE

      gosub Terminate

   ENDIF

exit

 

Terminate:

   @script::log("Terminating")

exit

The subroutine in this example forces an exit so it will never perform a return.

Flow Control