Exit Script/Program

The following page provides an example of exiting a script or program.

Example

This is extremely straightforward. Essentially it is the programmatic equivalent of pressing the ‘q‘ key, except one can output a return value, if required. For example:

import("sleep")
for i=1,99999 do print("tThis is gunna take almost forever to finish !?"); 
if i > 3 then exit("ntNot Forever!"); end; sleep(1) end
    This is gunna take almost forever to finish !?
    This is gunna take almost forever to finish !?
    This is gunna take almost forever to finish !?
    This is gunna take almost forever to finish !?

    Not Forever!

Too easy!

References

API