# check_break

Definition: | integer i = check_break()
Description: | Return the number of times that control-c or control-Break have been pressed since the last call to check_break(), or since the beginning of the program if this is the first call.
pwa/p2js: | Not supported
Comments: | This is useful after you have called allow_break(0) which prevents control-c or control-Break from terminating your program. You can use check_break() to find out if the user has pressed one of these keys. You might then perform some action such as a graceful shutdown of your program. Neither control-c nor control-Break will be returned as input characters when you read the keyboard. You can only detect them by calling check_break().
Example: |
    k = get_key()
    if check_break() then
        puts(1, "Shutting down...")
        save_all_user_data()
        abort(1)
    end if
Implementation: | See builtins\pbreak.e (an autoinclude) for details of the actual implementation.
See Also: | allow_break, get_key