Community Tip - You can change your system assigned username to something more personal in your community settings. X
Hello. I have a service, it must stop under a certain condition. This condition must contain the "break" construct. I need to make sure that this condition is called literally after every line in the script code. Of course, I did it, but in the end the code turned out to be huge. I tried to shorten it by putting the condition with "break" into the function, and taking the function out of the code. But as I understand it, "break" does not allow it to be used in this way. How it is possible to implement it correctly and beautifully?
@OI_8877786
If the code you are writing to test the condition is complex, putting it is a function seems like a good choice.
From your description I assume that the "Break" just ends the function. Not your goal. Another approach would have the function return a Boolean which would be a simple test in in the main code to determine if you should continue.
I believe there is also an exit command which might accomplish your goal.