Terminate execution and close window

edited January 2018 in Programming Questions

What language statement(s) will terminate execution and close the executable's window?

Tagged:

Answers

  • Thanks but that simply queues an exit for draw() completion. I want to exit without delay.

  • edited January 2018 Answer ✓

    exit();

    return;

  • That works! Can't imagine why exit() doesn't do that itself, but thanks!

  • edited January 2018

    I believe that some of the reasons exit was implemented to finish its draw frame before quitting had to do with OpenGL crashes in P3D.

    From the exit() reference page:

    Rather than terminating immediately, exit() will cause the sketch to exit after draw() has completed (or after setup() completes if called during the setup() function). For Java programmers, this is not the same as System.exit(). Further, System.exit() should not be used because closing out an application while draw() is running may cause a crash (particularly with P3D). https://processing.org/reference/exit_.html

    Returning draw() if you wish should work just fine.

    Processing.py exit() works in the same was as Processing (Java), although jdf is considering changing it....

  • Returning draw() if you wish should work just fine.

    That's the 'that' in my: "Can't imagine why exit() doesn't do that itself".

    I've has one crash since using it but cause unknown.

Sign In or Register to comment.