cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

For certain conditions, how to terminate the code without throwing error.

AP_9587236
17-Peridot

For certain conditions, how to terminate the code without throwing error.

For certain conditions, how to terminate the code without throwing error.

1 ACCEPTED SOLUTION

Accepted Solutions
DanZ
15-Moonstone
(To:AP_9587236)

Hi,

put your whole code in a self-executing function block and "return" if you want to end the execution.

 

const result = (function() {
   // Your code here
   // To end it all, simply "return"
})();

 

Or if you prefer the arrow function syntax:

const result = (() => {
   // Your code here
})();

 

View solution in original post

2 REPLIES 2
DanZ
15-Moonstone
(To:AP_9587236)

Hi,

put your whole code in a self-executing function block and "return" if you want to end the execution.

 

const result = (function() {
   // Your code here
   // To end it all, simply "return"
})();

 

Or if you prefer the arrow function syntax:

const result = (() => {
   // Your code here
})();

 

slangley
23-Emerald II
(To:AP_9587236)

Hi @AP_9587236.

 

To answer your question, we need to understand the conditions you refer to.  Can you provide some details of your use case?

 

Regards.

 

--Sharon

Top Tags