EXIT ["Message String" | messageStringVariable ]

The EXIT command causes your program to terminate immediately. You can use this command anywhere in your program for cases where the program has finished its work, but has not run to the textual end of the program.

The command accepts an optional literal string or a string variable argument. The argument will be printed to the Statistics101 Output Window when the command is executed.

See also: STRING

Here's an example demonstrating a use of the EXIT command:

CLEAROUTPUT
COPY 0 selection ' to force once through the outer loop
PRINT "\n=================================="
INPUT "Enter a vector: " var
WHILE 1 = 1 ' loop forever 
   PRINT "------------------------------------"
   PRINT "1. Enter a new vector."
   PRINT "2. Compute mean."
   PRINT "3. Compute standard deviation."
   PRINT "4. Compute range."
   PRINT "5. Quit.
   COPY 1 keepGoing    ' Force to go once through inner loop
   INPUT "Enter selection-> " selection
   IF selection = 1
      PRINT "\n=================================="
      INPUT "Enter a vector: " var
   ELSEIF selection = 2
      MEAN var result
      OUTPUT "  The mean is: %12.4G\n" result
   ELSEIF selection = 3
      STDEV var result
      OUTPUT "  The standard deviation is: %12.4G\n" result
   ELSEIF selection = 4
      MIN var varMin
      MAX var varMax
      OUTPUT "  The range is: %12.4G to %12.4G\n" varMin varMax
   ELSEIF selection = 5
      EXIT "Program terminated by user."
   ELSE
      PRINT "ERROR: selection must be between 1 and 5"
   END
END