Terminate

Conditionally ends a WIL program.

Syntax:

Terminate (expression, title, message)

Parameters:

(s) expression any logical expression.

(s) title the title of a message box to be displayed before termination.

(s) message the message in the message box.

Returns:

(i)  always 1.

 

This command ends processing for the WIL program if "expression" is nonzero. Note that many functions return @TRUE (1) or @FALSE (0), which you can use to decide whether to cancel a menu item.

If either "title" or "message" contains a string, a message box with a title and a message is displayed before exiting.

Examples:
;Example 1
; basically a no-op:
Terminate(@FALSE, "", "This will never terminate")
Message("Terminate","Terminated.")
Exit
;Example 2
; exits w/o message if answer isn't "YES":
Terminate(answer != "YES", "", "")
Message("Terminate","Terminated.")
Exit
;Example 3
; unconditional termination w/o message box (same as Exit)
Terminate(@TRUE, "", "")
Message("Terminate"," Terminated.")
Exit
;Example 4
; exits with message if variable is less than zero:
Terminate(a < 0, "Error", "Cannot use negative numbers")
Message("Terminate"," Terminated.")
Exit
See Also:

Display, Exit, Message, Pause