Conditionally ends a WIL program.
Terminate (expression, title, message)
(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.
(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.
;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