Exit script function

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

Locked
bogdyro
Posts: 241
Joined: 04 Apr 2015 15:14

Exit script function

Post by bogdyro » 27 Jul 2017 16:28

Hi Martin. I would like to have a function that exits the current script directly. Kind of like the break statement exists from a loop.
Currently I have to include all the statements I want executed inside the brackets of an if statement and it confuses the code a bit.
Or maybe something in the form of a throw exception statement with some kind of info attached to it. Then I would link that script to a debug dialog or other script for error handling.
Thanks.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Exit script function

Post by Martin » 27 Jul 2017 20:17

Hi,

You can use the return statement for this:

Code: Select all

log(1);
if (xyz) return;
log(2);
Regards,
Martin

bogdyro
Posts: 241
Joined: 04 Apr 2015 15:14

Re: Exit script function

Post by bogdyro » 28 Jul 2017 09:19

Ok Martin, didn't know that. Thx

Locked