Welcome to Portal

?Unknown\pull-down

Welcome to Zoho Cares

Bienvenido a Soporte de Zoho

Search our knowledge base, ask the community or submit a request.

Hi Everyone,


I have some script that evaluates multiple conditions, using some nested if statements.  If any of the conditions evaluates to true, there is no reason to continue the running through the other conditions.

Is there an Exit Sub command in Deluge?

Thanks,

Leo

11 users have this question.
19 Replies
Reply
3 more
  • 9 years ago

I completely agree.  I dont want to do a bunch of embedded "else ifs" because it's a debugging nightmare.  

Gets my vote.  Just trying to find an easy way to get to the end of a routine if I hit an error state?



  • 6 years ago

Agree, this feathrure should be included.

  • 4 years ago

+1'ing this, we need some way to exit a function

  • 4 years ago

1500 views on this, if you come here please like OP's orirginal post so we might actually see this feature at some point

  • 3 years ago

So many times I've wanted to have a simple exit;

Why won't you give us this?

  • Zoho MVP
  • 3 years ago

You can try use "break", not 100% sure it's fully supported yet as there is no documentation but it seems to work in this case:
  1.     counter = 0;
  2.     myList = {1,2,3,4,5,6,7,8,9};
  3.     //
  4.     for each i in myList
  5.     {
  6.         counter += 1;
  7.         if counter > 4
  8.         {
  9.             break;
  10.         }
  11.         info counter;
  12.     }
I know it's not exactly what you're looking for but may help.

https://www.zoho.com/deluge/help/misc-statements/try-catch.html

https://www.zoho.com/deluge/help/misc-statements/break.html

https://www.zoho.com/deluge/help/misc-statements/continue.html

  • Zoho MVP
  • 2 years ago

adding my vote to this....

https://www.zoho.com/deluge/help/misc-statements/try-catch.html

https://www.zoho.com/deluge/help/misc-statements/break.html

https://www.zoho.com/deluge/help/misc-statements/continue.html

I agree!

+1 add a "return" statement to exit a function early.  (no, not the existing "Return" task which is only supported in functions that return a value)

  • Zoho MVP
  • 9 days ago

@Damien

Those only work on loops and errors. Granted, the break statement can help cut down the time it takes to execute a test in a loop.

The main reasons for needing an explicit return statement are
  1. readability of code
    1. dealing with multiple nested if statements is hard to read.
  2. Fail quickly
    1. e.g. when doing a validity test in a sub before running the rest of the function. If it fails, and it's not an error, being able to exit the sub there and then without running further validity tests.
  3. Not needing flow control variables
    1. If you only have a break statement, you need to introduce, and test for, flow control variables to see if it's still valid to continue the rest of the sub. As if you've broken out of the loop, it could be because you've found an invalid entry (that again isn't an error condition).

  • Zoho MVP
  • 9 days ago

I've only worked with deluge so am not very familiar with the concept... However it seems like there may be workarounds until such a time as statements such as these can be introduced to Deluge.

I'm not sure if you are aware of it but there's a developer channel on cliq that you may be interested in, you can contact developer-community@zohocorp.com
and ask to be added to it.

Another point is that this is the Creator forum, and while Deluge is a huge piece maybe you might want to raise it as an Idea on the Deluge forum also...

Reply to Leo SaumureA
/* */
  • 12
  • Insert
  • Plain text
Add Comment
(Up to 20 MB )