I often like to exit early from Jython functions I write by returning. This helps keep nested if conditions to a minimum.
For instance, I’d check if data in arguments are valid and if they are not then return right away.
But I couldn’t do this when writing event handlers because event handlers are not functions. I could wrap the event handlers in functions but that’s extra work and an extra level of indentation.
But with Ignition release 7.1.2, there is now a way to exit early from event handler code. Calling sys.exit() kills the script it is in. Code past sys.exit() is not run.